(Area 2A)
Format 1 of the DEFINE command is used to explicitly define a field or array within an input file and should immediately follow the FILE command to which the fields are being defined.
Sample DEFINE Command Format 1
►►─┬─ DEFINE ─┬─ fieldname ─┬─ n1 ─ THRU ─ n2 ─┬─ data-type ──────────────────► └─ DEF ────┘ └─ n1 ─────────────┘ ►─┬─────────────────────────────────────────────────┬────────────────────────► └─┬─ HEADING ─┬─ ' heading 1 ' ─┬───────────────┬─┘ └─ HDG ─────┘ └─ 'heading 2' ─┘ ►─┬──────────────────────────────┬─┬──────────────────────────┬──────────────►◄ └─┬─ PICTURE ─┬─ ' edit ptn ' ─┘ └─ OCCURS ─ n ─┬─────────┬─┘ └─ PIC ─────┘ └─ TIMES ─┘
Is a user-supplied name assigned to the location specified in the DEFINE command. When accompanied by an OCCURS n TIMES clause, this field name represents the name of each array element.
Indicates, in bytes, the relative starting and ending positions of the field in a record of the file. When the OCCURS n TIMES clause is used, n1 THRU n2 specifies the starting and ending positions of the first array element within the record. The array element occurs n times in contiguous locations.
TO or – (dash) can be used in place of THRU.
Indicates that the field is one byte long and integer n1 is the position of the field within the record.
Describes the data type of the field. Use the following entries:
Indicates that the field contains alphanumeric data and can contain any EBCDIC character.
Works the same as data-type X for moves and compare operations but on a PRINT statement displays in HEX. For example, A12 would display as C1F1F2 on the print line. Maximum length is 62.
Indicates that the field contains zoned decimal data. d indicates the number of implied decimal places.
Indicates that the field contains packed decimal data. d indicates the number of implied decimal places.
Indicates that the field contains binary data. d indicates the number of implied decimal places.
Indicates that the field contains bit string data and must be only one byte long.
Indicates that the field contains unsigned binary data. d indicates the number of implied decimal places.
Specifies an optional separator indicating the literals that follow it are interpreted as headings.
Enables you to assign one or two heading lines to the field. Heading lines appear as column headings if the field is printed in a report. If you omit the parameter, the Reporting Facility assigns the field name as heading 1, with no second heading line.
Assigns an edit mask to the field when it is printed, overriding the default editing. PIC is the short form of PICTURE.
Indicates that this is an array definition and the array element being defined occurs n times in contiguous locations in the record.
Example
Assume the following for an input file. The sample DEFINE commands following the input file illustrate techniques for defining individual fields that are accessible to the Reporting Facility.
A 2-character transaction code
A 4-character ID number
A 7-character (5 integers, 2 decimals) zoned decimal AMOUNT field.
An 8-character DATE field in the format of MM/DD/YY
A 1-character indicator showing whether the transaction is cleared
A 20-character PAYEE field
A 1-character filler
A 32-character REASON field
FILE ...
DEFINE TRANSACTION-CODE 1-2 X
DEFINE ID-NUMBER 3-6 X 'CHECK' 'NUMBER'
DEFINE AMOUNT 7-13 N2 'TRANSACTION' 'AMOUNT'
PICTURE '$$,$$9.99-'
DEFINE ACTIVITY-DATE 14-21 X 'DATE OF' 'ACTIVITY'
DEF CLEARED 22 X
DEF PAYEE 23 TO 42 X
DEFINE REASON 44 THRU 75 X
|
Copyright © 2014 CA.
All rights reserved.
|
|