You define items by using definition specifications. Definitions can appear in two places within a module or program: within the cycle-main source section and within a subprocedure. (The main source section consists of the first set of H, F, D, I, C, and O specifications in a module; it corresponds to the specifications found in a standalone program or a cycle-main procedure.) Depending on where the definition occurs, there are differences both in what can be defined and also the scope of the definition. Specify the type of definition in positions 24 through 25, as follows:
Definitions of data structures, prototypes, and procedure interfaces end with the first definition specification with non-blanks in positions 24-25, or with the first specification that is not a definition specification.
*-----------------------------------------------------------------*
* Global Definitions
*-----------------------------------------------------------------*
D String S 6A INZ('ABCDEF')
D Spcptr S *
D SpcSiz C 8
D DS1 DS OCCURS(3)
D Fld1 5A INZ('ABCDE')
D Fld1a 1A DIM(5) OVERLAY(Fld1)
D Fld2 5B 2 INZ(123.45)
D Switch PR
D Parm 1A
...
*-----------------------------------------------------------------*
* Local Definitions
*-----------------------------------------------------------------*
P Switch B
D Switch PI
D Parm 1A
* Define a local variable.
D Local S 5A INZ('aaaaa')
...
P E