User's Guide

TAB2ASC

Converts a labeled table(LT) file to an ASCII data file.

Function:

Converts a labeled table (LT) file to an ASCII data file.

Parameters:

INLT
Input labeled table. The name of the labeled table file; the fields specified by ATRNAME are read from this file. The main labeled table file can have subfiles, but the subfiles cannot have their own subfiles.

OUTFILE
Output file. The output file is a ASCII file arranged in rows and columns. The number of columns in the output ASCII file will depend upon column numbers specified in OUTCOL and the size of the matrix associated with ATRNAME.

ATRNAME
Attribute name. This is the attribute name(s) of the field(s) in the labeled table file(s) whose values will be read and then written to OUTFILE. If the attribute name occurs in more than one labeled table file, the values from the last labeled table file will be used. The number of values specified in ATRNAME and OUTCOL must be equal.

OUTCOL(--)
Output columns. The columns in OUTFILE at which the input fields specified by ATRNAME begin. The columns do not represent a specific character position in a file. The number of values specified in ATRNAME and OUTCOL must be equal.

TIEATR(--)
Tie attribute. This is the attribute which ties the data of the main labeled table to the data of the subfiles. This attribute should be found in all the labeled table files.

Example:

  1. LAS> tab2asc inlt=in.dat outfile=out.dat atrname=("id","location","label") outcol=(1,3,5) tieatr= --

    The labeled table file IN.DAT, which contains at least three fields of data, is opened for read access. Column 1 of OUT.DAT will contain the field of IN.DAT which has an attribute name of ID. Column 3 of OUT.DAT will contain the field of IN.DAT which has an attribute name of LOCATION. Column 5 of OUT.DAT will contain the field of IN.DAT which has an attribute name of LABEL. Because there are two values for the attribute LOCATION, the value of LABEL will be placed in column 6. The second value of LOCATION will be placed in column 4 of OUT.DAT. Column 2 of OUT.DAT will contain zeros. When all the records have been read and written to OUT.DAT, the files are closed and the completion message is displayed.

    	 IN.DAT file
    	 -----------
    	 ;
    	 "COORD","LAT/LON COORDINATES";
    	 "ID","I4","POINT ID",1,1
    	 "LOCATION","R8","LOCATION IN LAT/LON",1,2
    	 "LABEL","C","POINT LABEL",1,16;
    	 1,43000000,-98000000,"POINT-1";
    	 2,43000000,-97000000,"POINT-1";
    	 3,42000000,-97000000,"POINT-1";
    	 4,42000000,-98000000,"POINT-1";
    
    	 OUT.DAT file
    	 ------------
    	 1 0 43000000 -98000000 0 POINT-1;
    	 2 0 43000000 -97000000 0 POINT-2;
    	 3 0 42000000 -97000000 0 POINT-3;
    	 4 0 42000000 -98000000 0 POINT-4;
     
    

Description/Algorithm:

After reading and parsing the parameter values, the input labeled table file(s) and output ASCII file are opened for read and write, respectively. The fields specified by ATRNAME are read in a record at a time and written to the output ASCII file. After all the records have been written to the output ASCII file, all the files are closed and the completion message is displayed.

Nonfatal Error Messages:

    None.

Fatal Error Messages:

  1. [tab2asc-attribute] Attribute <XXXX> was not found

    The attribute <XXXX> was not found in the main labeled table file or any of its subfiles. Respecify the attribute name.

  2. [tab2asc-equal] ATRNAME and OUTCOL are not equal

    The number of values specified in the parameters ATRNAME, and OUTCOL are not equal. Respecify one or more of the parameters.

  3. [tab2asc-fatal] Fatal error encountered

    A fatal error was encountered during processing. The output file may or may not be valid. The message that is displayed immediately preceding this message is the specific error that was encountered.

  4. [tab2asc-open] Error opening <XXXXX> file

    An error was encountered while trying to open the specified file. Verify that the file exists.

  5. [tab2asc-read] Error reading input file

    An error was encountered while trying to read the specified file. Verify the format of the file.

  6. [tab2asc-write] Error writing output file

    An error was encountered while trying to write the specified file. Verify the amount of disk space available.

User Note:

  1. A related function is ASC2TAB.