The DEFINE control statement defines fields to retain or store the content of data or values.
DEFINE field BIN(len) CHAR(len) DATE PACK(len)
Alternate specifications are specified in a columnar fashion.
Defined fields are not sent to or received from sort unless the field is part of the SORT control statement.
Important! Do not use the same name as any field in the database or unpredictable results occur.
where:
Specifies the name of the field to define.
The name can be 1–12 characters in length and must begin with an alphabetic or national character ($, #, @). Multiple field names can be defined by enclosing a list of field names in parentheses.
Specifies that the field is defined as a binary field.
len specifies the length of the binary field.
The length is specified in bytes and can be a number from 1 through 4. Binary fields other than 4 bytes do not carry a sign. The alias for BIN is BINARY.
If the length is omitted, the field is 4 bytes in length.
Specifies that the field is defined as a character field.
len specifies the length.
The length, specified in bytes, can be a number from 1 through 256. The alias for CHAR is CHARACTER.
If the length is omitted, the field is 1 byte in length.
Specifies the definition of a date field.
A date field is maintained internally as the number of days from January 1, 1900 in binary. Date fields print (PRINT control statement) in the default date format and output (OUTPUT control statement) as a 4-byte packed Julian date. These formats can be altered by using the EDIT function.
Specifies that the field is defined as a packed field.
len specifies the length of the packed field.
The length is specified in bytes and can be a number from 1 through 8. The aliases for PACK are PACKED, DEC, and DECIMAL. The default length for the field type (8 bytes) is used if the length is omitted.
To define a 20-byte character field named CHR, specify:
/DEFINE CHR CHAR(20)
To define three fields I, J, and K as binary, specify:
/DEFINE (I,J,K) BIN
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|