LOB host variables in ILE RPG applications that use SQL
Here are some examples of LOB host variables (CLOB, DBCLOB, BLOB) in ILE RPG applications.
CLOB example
The following declaration in free-form:
DCL-S MYCLOB SQLTYPE(CLOB:1000);
or the following declaration in fixed-form:
D MYCLOB S SQLTYPE(CLOB:1000)
results in the generation of the following structure:
D MYCLOB DS
D MYCLOB_LEN 10U
D MYCLOB_DATA 1000A
DBCLOB example
The following declaration in free-form:
DCL-S MYDBCLOB SQLTYPE(DBCLOB:400);
or the following declaration in fixed-form:
D MYDBCLOB S SQLTYPE(DBCLOB:400)
results in the generation of the following structure:
D MYDBCLOB DS
D MYDBCLOB_LEN 10U
D MYDBCLOB_DATA 400G
BLOB example
The following declaration in free-form:
DCL-S MYBLOB SQLTYPE(BLOB:500);
or the following declaration in fixed-form:
D MYBLOB S SQLTYPE(BLOB:500)
results in the generation of the following structure:
D MYBLOB DS
D MYBLOB_LEN 10U
D MYBLOB_DATA 500A
Notes:
- For BLOB and CLOB, 1 ≤ lob-length ≤ 16 773 100.
- For DBCLOB, 1≤ lob-length ≤ 8 386 550.
- LOB host variables are allowed to be declared in host structures.
- LOB host variables are not allowed in host structure arrays. LOB locators should be used instead.
- LOB host variables declared in structure arrays cannot be used as standalone host variables.
- SQLTYPE, BLOB, CLOB, DBCLOB can be in mixed case.
- SQLTYPE must be between positions 44 to 80 for fixed-form declarations.
- When a LOB is declared as a stand-alone host variable, position 24 must contain the character 'S' and position 25 must be blank for fixed-form declarations.
- The stand-alone field indicator S in position 24 for fixed-form declarations should be omitted when a LOB is declared in a host structure.
- LOB host variables cannot be initialized.