Product Documentation

FairCom ISQL

Previous Topic

Next Topic

The DEFINE RECORD Statement

The DEFINE RECORD statement is used to define the record of the output file. The following are the definitions that are made known by the DEFINE RECORD statement:

  • Names the record of the output file
  • Names the fields of the record
  • Specifies whether the records in the data file are variable length records or fixed length records
  • If fixed length records, specifies the position and data type of the field

The following is the syntax definition of the DEFINE RECORD statement:


DEFINE RECORD record_name

[ OF FIXED LENGTH record_length

AS (

field_name position_specification type_specification,

...

)

]


[ FIELD DELIMITER delimiter_char ]

[ RECORD DELIMITER delimiter_string ] ;


position_specification::

POSITION ( start_position : end_position )


type_specification::

| CHAR

| SHORT

| LONG

| FLOAT

| DOUBLE


The following are the variable descriptions of the DEFINE RECORD syntax:

  • record_name is the name used to refer to the records found in the data file.
  • record_length is the length of the fixed length record. This length should include the length of field or record delimiters, if any.
  • field_name is the name used to refer to a field in the data file.
  • delimiter_char is the field delimiter and is a single character. delimiter_char must be specified as a literal.
  • delimiter_string is the record delimiter and can be a single character or a string. It must be specified as a literal.
  • start_position is the position where the field starts. It must be an unsigned integer.
  • end_position is the position where the field ends. It must be an unsigned integer.

The first position of each record is 1 and not 0.

If DATE, TIME, and TIMESTAMP types are to be dumped they can be specified as characters in the commands file. If it is a fixed length record then the type specification can be CHAR.

The following is an example of the DEFINE RECORD statement for fixed length records:


DEFINE RECORD rec_one OF FIXED LENGTH 20

AS (

fld1 POSITION (1:4) SHORT,

fld2 POSITION (5:15) CHAR,

fld3 POSITION (16:20) CHAR

) ;


See also:

TOCIndex