Previous Topic: DEFINE Command Format 1Next Topic: DEFINE Command Format 3


DEFINE Command Format 2

(Area 2B)

Format 2 of the DEFINE command defines a field or array within the General Storage Area (GSA). The GSA, which the system creates automatically, is basically a scratch pad that you can use to define standard literals or tables of data for use in the program. (The GSA can be equated to a COBOL Working Storage section.) The system also uses the GSA for immediate storage of special work areas during the compilation process.

Sample DEFINE Command Format 2

►►─┬─ DEFINE ─┬─ fieldname ─┬───────────┬─ = ─┬─ num lit ──┬──────────────────►
   └─ DEF ────┘             ├─ (n1.n2) ─┤     └─ 'string' ─┘
                            └─ (n1) ────┘

 ►─┬─────────────────────────────────────────────────┬────────────────────────►
   └─┬─ HEADING ─┬─ ' heading 1 ' ─┬───────────────┬─┘
     └─ HDG ─────┘                 └─ 'heading 2' ─┘

 ►─┬──────────────────────────────┬───────────────────────────────────────────►
   └─┬─ PICTURE ─┬─ ' edit ptn ' ─┘
     └─ PIC ─────┘

 ►─┬──────────────────────────────────────────────────────────┬───────────────►◄
   └─ OCCURS ─ n ─┬─────────┬ ─┤ VALUE and FILL Parameters ├ ─┘
                  └─ TIMES ─┘

Expansion of VALUE and FILL Parameters

├──┬──────────────────────────────────┬───────────────────────────────────────►
   └─ VALUE ─┬─ num lit 2-n ────────┬─┘
             ├─ 'string' 2-n ───────┤
             └─ X'hex literal' 2-n ─┘

 ►─┬───────────────────────────────┬───────────────────────────────────────────┤
   └─ FILL ─┬─ num lit-d ────────┬─┘
            ├─ 'string'-d ───────┤
            └─ X'hex literal'-d ─┘
fieldname

Is a user-supplied name in accordance with the Reporting Facility naming conventions that are assigned to the location specified in the DEFINE command. When accompanied by an OCCURS n TIMES clause, this field name represents the name of one array element.

n1.n2

Indicates that this is a packed decimal field that contains n1 integers and n2 decimals. The value (n1 + n2) cannot exceed 15.

n1

Indicates that the field is an alphanumeric field n1 bytes long.

num lit 'string'

Assigns an initial numeric value to the field. If the field is part of an array, this is the initial value of the first element.

HEADING

Specifies an optional separator used to denote that subsequent literals should be interpreted as headings. It is used primarily in conjunction with the VALUE clause. HDG can be used in place of HEADING.

'heading 1' 'heading 2'

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.

PICTURE 'edit ptn'

Assigns an edit mask to be used to edit the field when it is printed, overriding the Reporting Facility default editing. PIC can be used in place of PICTURE.

OCCURS n TIMES

Indicates that this is an array definition. The array element being defined occurs n times in contiguous locations in the GSA.

VALUE

Optional separator used to denote that the subsequent literals are to be interpreted as initial values for array elements 2-n. It is only valid when used in conjunction with the OCCURS clause, and must immediately follow either the OCCURS or FILL clause. VAL can be used in place of VALUE.

num lit 2-n

When defining a numeric array, this parameter assigns an initial numeric value to elements 2 through n, where n is the number of occurrences specified in the OCCURS n TIMES clause.

'string' 2-n

When defining an alphanumeric array, this assigns an initial alphanumeric value to elements 2 through n, where n is the number of occurrences specified in the OCCURS n TIMES clause.

X'hex literal' 2-n

When defining an alphanumeric array, this assigns an initial hexadecimal value to elements 2 through n, where n is the number of occurrences specified in the OCCURS n TIMES clause.

FILL

The FILL clause initializes (places) the FILL literal in each of the remaining occurrences that were not initialized by the VALUE clause. It is valid only when used in conjunction with the OCCURS clause and must immediately follow either the OCCURS or VALUE clause.

num lit-d

When defining a numeric array, this parameter specifies the numeric FILL value to elements 2-n when the initial values are not specified. d indicates the number of implied decimal places.

'string'-d

When defining an alphanumeric array, this parameter specifies the alphanumeric FILL value to elements 2-n when the initial values are not specified.

X'hex literal'-d

When defining an alphanumeric array, this parameter specifies the hexadecimal FILL value to elements 2-n when the initial values are not specified. The literal must contain an even number of valid hexadecimal digits. d indicates the number of implied decimal places.