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:
pos1
-- INTEGER, is the optional starting position of the field.
pos2
-- INTEGER, is the optional last position of the field.
type
-- defines the type of information as:
R
-- REAL number, single precision,
D
-- real number, DOUBLE PRECISION,
I
-- INTEGER number,
C
-- CHARACTER string.
format
-- defines the format associated with that field and used for listing out its values. Supported format are FORTRAN 77 standard format or special formats to accommodate sexagesimal values (Sww.dd) and time values (Tww.dd). These formats may be defaulted, the defaults being defined as:
Aw
-- for CHARACTER string, where w = pos2-pos1+1
I11
-- for INTEGER
E12.6
-- for REAL in single precision
D24.17
-- for REAL in double precision
label
-- defines the associated label, according to the rules in section 5.6.
unit
-- defines, optionally, the associated units.

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 = " $\backslash$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
http://www.eso.org/midas/midas-support.html
1999-06-09