Host structures in PL/I

A PL/I host structure is a structure that contains subordinate levels of scalars. You can use the name of the structure as shorthand notation to reference the list of scalars.

Requirements: Host structure declarations in PL/I must satisfy the following requirements:
  • Host structures are limited to two levels.
  • You must terminate the host structure variable by ending the declaration with a semicolon, as in the following example:
    DCL 1 A,
        2 B CHAR,
        2 (C, D) CHAR;
    DCL (E, F) CHAR;
  • You can specify host variable attributes in any order that is acceptable to PL/I. For example, BIN FIXED(31), BIN(31) FIXED, and FIXED BIN(31) are all acceptable.

When you reference a host variable, you can qualify it with a structure name. For example, you can specify STRUCTURE.FIELD.

Host structures

The following diagram shows the syntax for declaring host structures.

Read syntax diagramSkip visual syntax diagramDECLAREDCLlevel-1variable-nameScope and/or storage,,level-2var-1(,var-2)data-type-specification;

Data types

The following diagram shows the syntax for data types that are used within declarations of host structures.

Read syntax diagramSkip visual syntax diagramCHARACTERCHAR(integer)VARYINGVARGRAPHIC(integer)VARYINGVARBINARYBINDECIMALDECFIXED(precision,scale)FLOAT(precision)SQL TYPE ISROWIDLOB data type

LOB data types

The following diagram shows the syntax for LOB data types that are used within declarations of host structures.

Read syntax diagramSkip visual syntax diagramSQL TYPE IS CHARACTER LARGE OBJECTCHAR LARGE OBJECTCLOBDBCLOBBINARY LARGE OBJECTBLOB(lengthKMG)CLOB_LOCATORDBCLOB_LOCATORBLOB_LOCATORCLOB_FILEDBCLOB_FILEBLOB_FILE

LOB data types for XML data

The following diagram shows the syntax for LOB data types that are used within declarations of host structures for XML data.

Read syntax diagramSkip visual syntax diagramSQL TYPE IS XML AS BINARY LARGE OBJECTBLOBCHARACTER LARGE OBJECTCHAR LARGE OBJECTCLOBDBCLOB(lengthKMG)BLOB_FILECLOB_FILEDBCLOB_FILE

Example

In the following example, B is the name of a host structure that contains the scalars C1 and C2.
DCL 1 A,
      2 B,
        3 C1 CHAR(...),
        3 C2 CHAR(...);