You define a subfield in free form
by specifying the name of the subfield
followed by keywords, or by specifying DCL-SUBF followed
by the subfield name and keywords.
You define a subfield in fixed form by specifying blanks in the Definition-Type
entry (positions 24 through 25) of a definition specification. The
subfield definition(s) must immediately follow the data structure
definition. In free-form, the subfield definitions end with the
END-DS statement. In fixed form, the subfield definitions end when a definition specification
with a non-blank Definition-Type entry is encountered, or when a different
specification type is encountered.
In fixed form, the name of the subfield is entered in positions 7 through 21.
To improve readability of your source, you may want to indent the
subfield names to show visually that they are subfields.
If the data structure is defined with the QUALIFIED keyword, the subfield names can be the same as other names within your program. The subfield names will be qualified by the owning data structure when they are used.
You can also define a subfield like an existing item using the
LIKE keyword. When defined in this way, the subfield receives the
length and data type of the item on which it is based.
Similarly,
you can use the LIKEDS keyword or LIKEREC keyword to define a subfield
as a data structure.
See Examples of defining data using the LIKE keyword for an example
using the LIKE keyword.
The keyword LIKEDS is allowed on any subfield definition. When specified, the subfield is defined to be a data structure, with its own set of subfields. If data structure DS has subfield S1 which is defined like a data structure with a subfield S2, a programmer must refer to S2 using the expression DS.S1.S2.


You can overlay the storage of a previously defined subfield with that of another subfield using the OVERLAY keyword. The keyword is specified on the later subfield definition. See Figure 4 for an example using the OVERLAY keyword.