Introduction
The specification file can be used to control the way fields are interpreted. This is particularly useful for date formats. The name of the format file should be used as the second, 'fmtfile', parameter in the 'ReadData' function call.
The file may contain comments in the same format as the main program source.
The overall layout is shown as follows :-
dataspec ::= [ global_list ] [ field_list ]
global_list ::= [Global] [[ entry ]]
field_list ::= [Fields] [[ fieldfmt ]]
fieldfmt ::= fieldnum : [[ entry ]]
entry ::= keyword = value ;
The various keywords are listed below. The value depends on the keyword. All the keywords may occur n the global section. Only some of them, as indicated below, may occur in the field list.
Keywords
Comment
This is a prefix to mark a line in the data file as a comment rather than data. A comment marker can only be a single character. Comments are always terminated by a line-feed character, even if that is not the record terminator. A comment may not occur within a data record.
Decimal
This specifies the decimal point used in the data file. The default value is '.'. This may specified by some other single character ( usually a comma ). The user should ensure that that the decimal point is not the same as the field separator. It may appear in the field list provided the field is numeric.
FileMode
Currently only the value Text is supported. This means that the data must be in ascii/unicode format ( the system should be able to deduce the actual encoding ).
HeadLines
This is the number of lines at to beginning of the file that should be ignored. This is to allow for systems that write out field names at the head of data files. The default is 0. A 'line' is determined by the line-feed character, not the data terminator character.
Language
The value for this field will be the same as for system initialisation file. The language will affect the month parsing and boolean value strings. If this value is omitted then the current default program language will be used.
Separator
By default the fields in a record are separated with a comma. This can be overridden with any other single character ( except quote characters ). Normally the value will be quoted, e.g. '|' for "bar delimited files".
Terminator
By default a data record is terminated with the newline character. This can be replaced by any other single character ( except quote characters ). Normally the value will be quoted, e.g. ';'.
TimeFormat
This is a string similar to a format string but just the main codes are use ( no length, padding or justification codes are used ). All data is parsed up to the next delimiter in the specification string. If the 'Y' ( year ) code is used it may be followed by [ year ]; this signified the first year to use if the year in the data is less than 100. The time format may appear in the fields section providing the field is a Date/Time field.
If the ordinal suffix or weekday are specified they will be scanned over without any checks. The am/pm indicator will be used to adjust the hour value.
Example
[Global] FileMode = Text; Language = Swedish; HeadLines = 0; Comment = '#'; Separator = '|'; Terminator = ';'; TimeFormat = "Y-N-D H:T:S.F"; [Fields] 3: [= the third field has a two digit year starting at 1970 =] TimeFormat = "Y[1970]-M-D";