LOB host variables in ILE RPG applications that use SQL

The following are examples of LOB host variables in ILE RPG.

CLOB example

The following declaration:

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:

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:

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:
  1. Start of changeFor BLOB and CLOB, 1 ≤ lob-length ≤ 65 531End of change
  2. For DBCLOB, 1≤ lob-length ≤ 16 383
  3. LOB host variables are allowed to be declared in host structures.
  4. LOB host variables are not allowed in host structure arrays. LOB locators should be used instead.
  5. LOB host variables declared in structure arrays cannot be used as standalone host variables.
  6. SQLTYPE, BLOB, CLOB, DBCLOB can be in mixed case.
  7. SQLTYPE must be between positions 44 to 80.
  8. When a LOB is declared as a stand-alone host variable, position 24 must contain the character 'S' and position 25 must be blank.
  9. The stand-alone field indicator S in position 24 should be omitted when a LOB is declared in a host structure.
  10. LOB host variables cannot be initialized.