9 242 1 Output File Formats

LANSA Technical

9.242.1 Output File Formats

Currently the following output formats are supported. In the examples this notation is used:

<OptCR>

Indicates an optional carriage return character.

<nl>

Indicates a new line (or line feed) character.

<t>

Indicates a horizontal tab character.

 

A - Normal Delimited File

B - DBF File

C - Columnized File (Numeric Fields Have Leading Signs)

D - Columnized File (Numeric Fields do NOT have Signs)

O - Comma Delimited File

T - Horizontal Tab Delimited Files

dBASE III PLUS Field Format Supported

A - Normal Delimited File

One of the most common file formats. Alpha, BLOB, CLOB fields are enclosed in double quote signs (") and trailing blanks are removed. A completely blank field appears as a single blank enclosed in double quotes (i.e. " ").

Date, DateTime, Time , Char and String fields are saved like Alpha. In Char and String fields trailing blanks are not removed.

Integer, Float, Packed and Signed fields appear with a leading negative sign, leading zeros suppressed and a decimal point (where required).

Boolean field occupies 1 byte. FALSE value appears as 'F'. TRUE appears as 'T'.

Individual fields are delimited by a comma (,).

The length of each file record may vary.

The position of an individual field within a record may vary from record to record. This is not a "fixed format" file. For example:

"SMITH","IAN",2153,345.56,"ADM",-456.78<OptCR><nl>

 

B - DBF File

This option tells the BIF to produce dBASE III PLUS, without memo DBF files. It is another common file format used to exchange information with other environments such as Microsoft Excel. Refer to dBASE III PLUS Field Format Supported more details.

There are limitations to this option. Below are listed both supporeted and non-supported types.

Supported Types

Alpha/Char/String ( up to 254 bytes only ), stored as Character

Packed and Signed field values are stored as DBF Numeric.

Date field value is stored as DBF Date

DateTime field value is stored as DBF  Timestamp. Fraction may be lost during the transforming process.

A Timestamp value occupies 8 bytes in DBF file – two longs, first for date, second for time.  The date is the number of days since  01/01/4713 BC ( Julian day ) . Time is hours * 3600000L + minutes * 60000L + Seconds * 1000L. Please refer Julian Day Count for details about Julian Day Count algorithm.

Time field value is stored as DBF Timestamp. But only last 2 bytes will be used. The value of the first 2 bytes will be 1900-01-01

Integer field value is stored as DBF Numeric. 1 byte Integer occupies 4 bytes including sign. 2 bytes Integer occupies 6 bytes including sign . 4 bytes Integer occupies 11 bytes including sign. 8 bytes Integer occupies 20 bytes. The value firstly is converted to a string (radix 10), if the length of the string is smaller than the required length, it will be right padded by BLANKs.

Float field value is stored as DBF Double.

Boolean field value is stored as DBF Logical

Unsupported Types

Alpha, Char, String with length > 254, Integer 8, BLOB and CLOB.

C - Columnized File (Numeric Fields Have Leading Signs)

Produces a columnized or "fixed format" file. The length of each file record is identical (unless appendage lists are used ... see later note) and the position of an individual field is identical within each record.

The width of a field's resulting column (and thus the overall "record layout" of the file) can be predicted by the following rules:

  • Alpha, BLOB, CLOB Date, DateTime, Time , Char and String fields have the same length as their definition in the Data Dictionary or RDML function.
  • For Packed and Signed fields the length is their Total Digits defined in the Data Dictionary or RDML function plus 1(for the leading sign). Note that this is the "Total Digits", not the computed storage or byte length for Packed fields.
  • 8 bytes Integer field occupies 20 bytes in the output file ( include the leading sign).
  • 4 bytes Integer field occupies 11 bytes in the output file ( include the leading sign).
  • 2 bytes Integer field occupies 6 bytes  in the output file ( include the leading sign).
  • 1 byte Integer field occupies 4 bytes ( include the leading sign).
  • 4 bytes Float field occupies 14 bytes ( include the leading sign)
  • 8 bytes Float field occupies 23 bytes( include the leading sign)
  • Unlike type A and T formats, which do not show a leading positive sign, this format always includes a leading positive or negative sign. Even UNSIGNED Integer will have a positive sign.

    If the field has decimal positions (and the option to remove decimal points is not being used) increment the length by 1 to allow for the decimal point(this is not applicable for Float, where the dot '.'  presence is compulsory). For example:

A(12) A(9) S(4,0) P(9,2) A(3) P(7,2)

..........:........:....:..........:..:........ SMITH IAN +2153+0000345.56ADM-00456.78<OptCR><nl>

 

D - Columnized File (Numeric Fields do NOT have Signs)

  • Produces a file exactly as for type "C" except that Packed, Signed, Integer and Float fields do not have a leading sign. For examples:
  • With decimal points included:

    A(12) A(9) S(4,0)P(9,2) A(3) P(7,2)

    ..........:........:...:.........:..:....... SMITH IAN 21530000345.56ADM00456.78<OptCR><nl>

     

    With decimal points removed:

    A(12) A(9) S(4,0)P(9,2) A(3) P(7,2)

    ..........:........:...:........:..:...... SMITH IAN 2153000034556ADM0045678<OptCR><nl>

     

  • All the rules applied to predict the width of a fields resulting column are the same as for type "C" with an exception for Packed, Signed, Integer or Float fields: 1 must be subtracted from the result.
  • Float field Note:
    The Float field value is converted into  "scientific notation" representation.
    For example:
    The biggest double float value that can be handled by some C compilators in "scientific notation" representation is: 1.7976931348623158E+308

    O - Comma Delimited File

    A common file format. It has exactly the same format as type A files except that Alpha, BLOB, CLOB Date, DateTime, Time , Char and String fields are not enclosed in double quotes.

    T - Horizontal Tab Delimited Files

    A popular file format. It has exactly the same format as type A files except that Alpha, BLOB, CLOB Date, DateTime, Time , Char and String fields are not enclosed in double quotes and individual fields are delimited by the horizontal tab character. For example:

    SMITH<t>IAN<t>2153<t>345.56<t>ADM<t>-456.78<OptCR><nl>