PL/I does not have variables that correspond to the SQL data types for LOBs (large objects). To create host variables that can be used with these data types, use the SQL TYPE IS clause. The SQL precompiler replaces this declaration with a PL/I language structure in the output source member.
The following figure shows the syntax for valid LOB host variables.
>>-+-DECLARE-+--+-variable-name-----------+---------------------> '-DCL-----' | .-,-------------. | | V | | '-(----variable-name-+--)-' >--SQL TYPE IS--+-CLOB-+--(--lob-length--+---+--)--;----------->< '-BLOB-' '-K-'
The following declaration:
DCL MY_CLOB SQL TYPE IS CLOB(16384);
Results in the generation of the following structure:
DCL 1 MY_CLOB, 3 MY_CLOB_LENGTH BINARY FIXED (31) UNALIGNED, 3 MY_CLOB_DATA CHARACTER (16384);
The following declaration:
DCL MY_BLOB SQL TYPE IS BLOB(16384);
Results in the generation of the following structure:
DCL 1 MY_BLOB, 3 MY_BLOB_LENGTH BINARY FIXED (31) UNALIGNED, 3 MY_BLOB_DATA CHARACTER (16384);
The following figure shows the syntax for valid LOB locators.
>>-+-DECLARE-+--+-variable-name-----------+---------------------> '-DCL-----' | .-,-------------. | | V | | '-(----variable-name-+--)-' >--SQL TYPE IS--+-CLOB_LOCATOR---+--;-------------------------->< +-DBCLOB_LOCATOR-+ '-BLOB_LOCATOR---'
The following declaration:
DCL MY_LOCATOR SQL TYPE IS CLOB_LOCATOR;
Results in the following generation:
DCL MY_LOCATOR BINARY FIXED(31) UNALIGNED;
BLOB and DBCLOB locators have similar syntax.
The following figure shows the syntax for valid LOB file reference variables.
>>-+-DECLARE-+--+-variable-name-----------+---------------------> '-DCL-----' | .-,-------------. | | V | | '-(----variable-name-+--)-' >--SQL TYPE IS--+-CLOB_FILE---+--;----------------------------->< +-DBCLOB_FILE-+ '-BLOB_FILE---'
The following declaration:
DCL MY_FILE SQL TYPE IS CLOB_FILE;
Results in the generation of the following structure:
DCL 1 MY_FILE, 3 MY_FILE_NAME_LENGTH BINARY FIXED(31) UNALIGNED, 3 MY_FILE_DATA_LENGTH BINARY FIXED(31) UNALIGNED, 3 MY_FILE_FILE_OPTIONS BINARY FIXED(31) UNALIGNED, 3 MY_FILE_NAME CHAR(255);
BLOB and DBCLOB locators have similar syntax.
The pre-compiler will generate declarations for the following file option constants: