Data Specification Files

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 'ReadData' function call.

The file may contain comments in the same format as the main program source.

Global

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 ).

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.

HeadLines

This is the number of at to beginning of the file that should be ignored. This is to allow for system 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.

Comment

This is a prefix to mark a line 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.

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 parses 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.

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.

Fields

The format for a specific field can be overridden in this section by stating the field number and a new format specifier. This currenty works only with time/date fields.

fieldfmt ::= fieldnum : [[ keyword = format ; ]]

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";