COBOL 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 COBOL language structure in the output source member.
LOB host variables are only supported in ILE COBOL for iSeries™.
>>-01--variable-name--------------------------------------------> .-IS-. .-USAGE--+----+-. >--+---------------+--SQL TYPE IS--+-CLOB---+--(--lob-length--+---+--)--> +-DBCLOB-+ +-K-+ '-BLOB---' '-M-' >-- . ---------------------------------------------------------><
The following declaration:
01 MY-CLOB SQL TYPE IS CLOB(16384).
Results in the generation of the following structure:
01 MY-CLOB. 49 MY-CLOB-LENGTH PIC 9(9) BINARY. 49 MY-CLOB-DATA PIC X(16384).
The following declaration:
01 MY-DBCLOB SQL TYPE IS DBCLOB(8192).
Results in the generation of the following structure:
01 MY-DBCLOB. 49 MY-DBCLOB-LENGTH PIC 9(9) BINARY. 49 MY-DBCLOB-DATA PIC G(8192) DISPLAY-1.
The following declaration:
01 MY-BLOB SQL TYPE IS BLOB(16384).
Results in the generation of the following structure:
01 MY-BLOB. 49 MY-BLOB-LENGTH PIC 9(9) BINARY. 49 MY-BLOB-DATA PIC X(16384).
>>-01--variable-name--------------------------------------------> .-IS-. .-USAGE--+----+-. >--+---------------+--SQL TYPE IS--+-CLOB-LOCATOR---+-- . ----->< +-DBCLOB-LOCATOR-+ '-BLOB-LOCATOR---'
CLOB and DBCLOB locators have similar syntax.
The following declaration:
01 MY-LOCATOR SQL TYPE IS BLOB_LOCATOR.
Results in the following generation:
01 MY-LOCATOR PIC 9(9) BINARY.
>>-01--variable-name--------------------------------------------> .-IS-. .-USAGE--+----+-. >--+---------------+--SQL TYPE IS--+-CLOB-FILE---+-- . -------->< +-DBCLOB-FILE-+ '-BLOB-FILE---'
The following declaration:
01 MY-FILE SQL TYPE IS BLOB-FILE.
Results in the generation of the following structure:
01 MY-FILE. 49 MY-FILE-NAME-LENGTH PIC S9(9) COMP-5. 49 MY-FILE-DATA-LENGTH PIC S9(9) COMP-5. 49 MY-FILE-FILE-OPTIONS PIC S9(9) COMP-5. 49 MY-FILE-NAME PIC X(255).
CLOB and DBCLOB file reference variables have similar syntax.
The pre-compiler will generate declarations for the following file option constants. You can use these constants to set the xxx-FILE-OPTIONS variable when you use File Reference host variables.