<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998) originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>Table Format Files</TITLE> <META NAME="description" CONTENT="Table Format Files"> <META NAME="keywords" CONTENT="vol1"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <LINK REL="STYLESHEET" HREF="vol1.css"> <LINK REL="next" HREF="node68.html"> <LINK REL="previous" HREF="node65.html"> <LINK REL="up" HREF="node55.html"> <LINK REL="next" HREF="node68.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1321" HREF="node68.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html1317" HREF="node55.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html1311" HREF="node66.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html1319" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html1320" HREF="node216.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="icons.gif/index_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html1322" HREF="node68.html">Example</A> <B> Up:</B> <A NAME="tex2html1318" HREF="node55.html">Table File System</A> <B> Previous:</B> <A NAME="tex2html1312" HREF="node66.html">List of Commands</A> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION00870000000000000000"> </A> <A NAME="table-format-files"> </A> <BR> Table Format Files </H1> <P> The conversion of ASCII data into table data can be done automatically (default option) for tables with <TT>REAL*4</TT> columns. In the case of more complex tables, a format file has to be provided to control this conversion. <P> Format files are <TT>ASCII</TT> files with an extension <TT>.fmt</TT>, used optionally by the commands <TT>CREATE/TABLE, READ/TABLE</TT> and <TT>PRINT/TABLE</TT> to control the input/output conversion. They may contain first a <TT>FS</TT> statement, they must contain then one <TT>DEFINE/FIELD</TT> statement for each column of the table and optional comment statements. <TT>DEFINE/FIELD</TT> statements follow the syntax: <BLOCKQUOTE> <TT>DEFINE/FIELD pos1 pos2 type [format] label [unit]</TT></BLOCKQUOTE>where:<DL COMPACT><DT><TT>pos1</TT> <DD>-- INTEGER, is the optional <I>starting position</I> of the field. <DT><TT>pos2</TT> <DD>-- INTEGER, is the optional <I>last position</I> of the field. <DT><TT>type</TT> <DD>-- defines the <I>type</I> of information as: <DL COMPACT> <DT><TT>R</TT> <DD>-- REAL number, single precision, <DT><TT>D</TT> <DD>-- real number, DOUBLE PRECISION, <DT><TT>I</TT> <DD>-- INTEGER number, <DT><TT>C</TT> <DD>-- CHARACTER string. </DL> <DT><TT>format</TT> <DD>-- defines the <I>format</I> 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 (<I>Sww.dd</I>) and time values (<I>Tww.dd</I>). These formats may be defaulted, the defaults being defined as: <DL COMPACT> <DT><TT>Aw</TT> <DD>-- for CHARACTER string, where w = pos2-pos1+1 <DT><TT>I11</TT> <DD>-- for INTEGER <DT><TT>E12.6</TT> <DD>-- for REAL in single precision <DT><TT>D24.17</TT> <DD>-- for REAL in double precision </DL> <DT><TT>label</TT> <DD>-- defines the associated <I>label</I>, according to the rules in section <A HREF="node65.html#command-overview">5.6</A>. <DT><TT>unit</TT> <DD>-- defines, optionally, the associated <I>units</I>.</DL> <P> The statement <TT>FS</TT> 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, <BR> FS = " <!-- MATH: $\backslash$ --> <IMG WIDTH="16" HEIGHT="44" ALIGN="MIDDLE" BORDER="0" SRC="img237.gif" ALT="$\backslash$">t", i.e TABS and blanks are used as field separators. <P> The following format file<BLOCKQUOTE> <TT>!+ <BR> ! Example format file test1.fmt <BR> !+ <BR> DEFINE/FIELD 1 9 C :NAME "NGC" <BR> DEFINE/FIELD 10 14 R F5.2 :RA "HOUR" <BR> DEFINE/FIELD 16 20 R F5.2 :DEC "DEGREE" <BR> DEFINE/FIELD 22 22 C :TYPE " " <BR> DEFINE/FIELD 24 26 I :RV "KM.SEC-1" <BR> END</TT></BLOCKQUOTE> <P> corresponds to an <TT>ASCII</TT> file, <TT>test1.dat</TT> say, with the following record structure: <BLOCKQUOTE> <TT>.........1.........2.........3 <BR> 123456789012345678901234567890 <BR> <BR> NGC 3379 10.75 12.85 E 893</TT></BLOCKQUOTE>(The ruler, of course, is not part of the data file.) <P> The following format file, using FS statement, <BLOCKQUOTE> <TT>!+ <BR> ! Example format file test2.fmt <BR> !+ <BR> FS = "" DEFINE/FIELD C :NAME "NGC" <BR> DEFINE/FIELD R F5.2 :RA "HOUR" <BR> DEFINE/FIELD R F5.2 :DEC "DEGREE" <BR> DEFINE/FIELD C :TYPE " " <BR> DEFINE/FIELD I :RV "KM.SEC-1" <BR> END</TT></BLOCKQUOTE> <P> can be used to create a table from the <TT>ASCII</TT> file <TT>test2.dat</TT><BLOCKQUOTE> <TT>NGC 3379<TAB>10.75<TAB>12.85<TAB>E<TAB>893</TT></BLOCKQUOTE><HR> <!--Navigation Panel--> <A NAME="tex2html1321" HREF="node68.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html1317" HREF="node55.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html1311" HREF="node66.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html1319" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html1320" HREF="node216.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="icons.gif/index_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html1322" HREF="node68.html">Example</A> <B> Up:</B> <A NAME="tex2html1318" HREF="node55.html">Table File System</A> <B> Previous:</B> <A NAME="tex2html1312" HREF="node66.html">List of Commands</A> <!--End of Navigation Panel--> <ADDRESS> <I>Petra Nass</I> <BR><I>1999-06-09</I> </ADDRESS> </BODY> </HTML>