Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide

Declaring host variables

Host variable declarations can be made at the same place as regular PL/I variable declarations.

Only a subset of valid PL/I declarations are recognized as valid host variable declarations. The preprocessor does not use the data attribute defaults specified in the PL/I DEFAULT statement. If the declaration for a variable is not recognized, any statement that references the variable might result in the message :

'The host variable token ID is not valid'

Only the names and data attributes of the variables are used by the preprocessor; the alignment, scope, and storage attributes are ignored.

Declaring scalar host variables

You must declare a scalar host variable with one of the following data attributes:

CHARACTER, GRAPHIC, or WIDECHAR
Host variables that are declared with the CHARACTER, GRAPHIC, or WIDECHAR attribute are called string host variables. The following restrictions apply to them:
FIXED BIN, FIXED DEC, or FLOAT
Host variables that are declared with the FIXED BIN, FIXED DEC, or FLOAT attribute are called numeric host variables. The following restrictions apply to them:
SQL TYPE
Host variables that are declared with the SQL TYPE attribute are called SQL TYPE host variables. The attribute specification must conform to one of the following syntax diagrams:
BINARY
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS-BINARY-(--length--)-----------------------------><
 
VARBINARY
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS-VARBINARY-(--length--)--------------------------><
 
Result set locator
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS-RESULT_SET_LOCATOR------------------------------><
 
ROWID
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS-ROWID-------------------------------------------><
 
Table locator
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS-TABLE LIKE--table-name--AS LOCATOR--------------><
 
LOB file reference
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS-+-BLOB_FILE---+---------------------------------><
               +-CLOB_FILE---+
               '-DBCLOB_FILE-'
 
LOB locator
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS--+-BLOB_LOCATOR---+-----------------------------><
                +-CLOB_LOCATOR---+
                '-DBCLOB_LOCATOR-'
 
LOB variable
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS-+-BLOB---+-(--length--+---+--)------------------><
               +-CLOB---+            +-K-+
               '-DBCLOB-'            +-M-+
                                     '-G-'
 
BLOB
You can also use BINARY LARGE OBJECT as an alternative for BLOB.
CLOB
You can also use either CHARACTER LARGE OBJECT or CHAR LARGE OBJECT as an alternative for CLOB.
XML LOB variable
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS XML AS-+-BLOB---+-(--length--+---+--)-----------><
                      +-CLOB---+            +-K-+
                      '-DBCLOB-'            +-M-+
                                            '-G-'
 
BLOB
You can also use BINARY LARGE OBJECT as an alternative for BLOB.
CLOB
You can also use either CHARACTER LARGE OBJECT or CHAR LARGE OBJECT as an alternative for CLOB.
XML file reference
Read syntax diagramSkip visual syntax diagram>>-SQL TYPE IS XML AS---+-BLOB_FILE---+------------------------><
                        +-CLOB_FILE---+
                        '-DBCLOB_FILE-'
 

The following constant declarations are generated by the SQL preprocessor. You can use them to set the file option variable when you use the file reference host variables:

DCL SQL_FILE_READ      FIXED BIN(31) VALUE(2);
DCL SQL_FILE_CREATE    FIXED BIN(31) VALUE(8);
DCL SQL_FILE_OVERWRITE FIXED BIN(31) VALUE(16);
DCL SQL_FILE_APPEND    FIXED BIN(31) VALUE(32);
Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide