next up previous contents index
Next: Example Up: Table File System Previous: List of Commands

Table Format Files

 

The conversion of ASCII data into table data can be done automatically (default option) for tables with REAL*4 columns. In the case of more complex tables, a format file has to be provided to control this conversion.

Format files are ASCII files with an extension .fmt, used optionally by the commands CREATE/TABLE, READ/TABLE and PRINT/TABLE to control the input/output conversion. They may contain first a FS statement, they must contain then one DEFINE/FIELD statement for each column of the table and optional comment statements. DEFINE/FIELD statements follow the syntax:

DEFINE/FIELD pos1 pos2 type [format] label [unit]

where:

The statement FS defines the list of field separators used in the ASCII data file. It is only used when pos1 and pos2 are not specified in the DEFINE/FIELD statement. This statement should be written as follows: FS = "f1f2f3". The number of field separators is not limited. If the blank is used as field separator and if the ascii data file contains character strings, the strings have to be enclosed by double quotes. Per default,
FS = "t", i.e TABS and blanks are used as field separators.

The following format file

!+
! Example format file test1.fmt
!+
DEFINE/FIELD 1 9 C :NAME "NGC"
DEFINE/FIELD 10 14 R F5.2 :RA "HOUR"
DEFINE/FIELD 16 20 R F5.2 :DEC "DEGREE"
DEFINE/FIELD 22 22 C :TYPE " "
DEFINE/FIELD 24 26 I :RV "KM.SEC-1"
END

corresponds to an ASCII file, test1.dat say, with the following record structure:

.........1.........2.........3
123456789012345678901234567890

NGC 3379 10.75 12.85 E 893

(The ruler, of course, is not part of the data file.)

The following format file, using FS statement,

!+
! Example format file test2.fmt
!+
FS = "" DEFINE/FIELD C :NAME "NGC"
DEFINE/FIELD R F5.2 :RA "HOUR"
DEFINE/FIELD R F5.2 :DEC "DEGREE"
DEFINE/FIELD C :TYPE " "
DEFINE/FIELD I :RV "KM.SEC-1"
END

can be used to create a table from the ASCII file test2.dat

NGC 3379<TAB>10.75<TAB>12.85<TAB>E<TAB>893


next up previous contents index
Next: Example Up: Table File System Previous: List of Commands



Pascal Ballester
Fri Mar 24 17:17:52 MET 1995