Host structures in COBOL
A COBOL host structure is a named set of host variables that are defined in your program's WORKING-STORAGE SECTION or LINKAGE SECTION.
- COBOL host structures can have a maximum of two levels, even though the host structure might occur within a structure with multiple levels.
- A host structure name can be a group name whose subordinate levels name elementary data items.
- If you are using the IMS coprocessor, do not declare host
variables or host structures on any subordinate levels after one of the following items:
- A COBOL item that begins in area A
- Any SQL statement (except SQL INCLUDE)
- Any SQL statement within an included member
When you write an SQL statement that contains a qualified host variable name (perhaps
to identify a field within a structure), use the name of the structure followed by a period and the
name of the field. For example, for structure B that contains field C1, specify
B.C1 rather than C1 OF B or C1 IN
B.
Host structures
The following diagram shows the syntax for declaring host structures.
- 1 level-1 indicates a COBOL level between 1 and 47.
- 2 level-2 indicates a COBOL level between 2 and 48.
- 3 For elements within a structure, use any level 02 through 48 (rather than 01 or 77), up to a maximum of two levels.
- 4 Using a FILLER or optional FILLER item within a host structure declaration can invalidate the whole structure.
Numeric usage items
The following diagram shows the syntax for numeric-usage items that are used within declarations of host structures.
Integer and decimal usage items
The following diagram shows the syntax for integer and decimal usage items that are used within declarations of host structures.
CHAR inner variables
The following diagram shows the syntax for CHAR inner variables that are used within declarations of host structures.
