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.
You must declare a scalar host variable with one of the following data attributes:
>>-SQL TYPE IS-BINARY-(--length--)-----------------------------><
>>-SQL TYPE IS-VARBINARY-(--length--)--------------------------><
>>-SQL TYPE IS-RESULT_SET_LOCATOR------------------------------><
>>-SQL TYPE IS-ROWID-------------------------------------------><
>>-SQL TYPE IS-TABLE LIKE--table-name--AS LOCATOR--------------><
>>-SQL TYPE IS-+-BLOB_FILE---+--------------------------------->< +-CLOB_FILE---+ '-DBCLOB_FILE-'
>>-SQL TYPE IS--+-BLOB_LOCATOR---+----------------------------->< +-CLOB_LOCATOR---+ '-DBCLOB_LOCATOR-'
>>-SQL TYPE IS-+-BLOB---+-(--length--+---+--)------------------>< +-CLOB---+ +-K-+ '-DBCLOB-' +-M-+ '-G-'
>>-SQL TYPE IS XML AS-+-BLOB---+-(--length--+---+--)----------->< +-CLOB---+ +-K-+ '-DBCLOB-' +-M-+ '-G-'
>>-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);