Declaration of file reference type host variables in REXX embedded SQL applications

You must declare LOB file reference host variables in your application. When REXX embedded SQL encounters these declarations, it treats the declared host variables as LOB file references for the remainder of the program.
The syntax for declaring LOB file reference host variables in REXX is:
Read syntax diagramSkip visual syntax diagramDECLARE ,:variable-name LANGUAGE TYPE BLOBCLOBDBCLOB FILE
Example:
   CALL SQLEXEC 'DECLARE :hv3, :hv4 LANGUAGE TYPE CLOB FILE' 
File reference variables in REXX contain three fields. For the preceding example they are:
hv3.FILE_OPTIONS.
Set by the application to indicate how the file will be used.
hv3.DATA_LENGTH.
Set by Db2® to indicate the size of the file.
hv3.NAME.
Set by the application to the name of the LOB file.
For FILE_OPTIONS, the application sets the following keywords:
Keyword (integer value)
Meaning
READ (2)
File is to be used for input. This is a regular file that can be opened, read and closed. The length of the data in the file (in bytes) is computed (by the application requester code) upon opening the file.
CREATE (8)
On output, create a new file. If the file already exists, it is an error. The length (in bytes) of the file is returned in the DATA_LENGTH field of the file reference variable structure.
OVERWRITE (16)
On output, the existing file is overwritten if it exists, otherwise a new file is created. The length (in bytes) of the file is returned in the DATA_LENGTH field of the file reference variable structure.
APPEND (32)
The output is appended to the file if it exists, otherwise a new file is created. The length (in bytes) of the data that was added to the file (not the total file length) is returned in the DATA_LENGTH field of the file reference variable structure.
Note: A file reference host variable is a compound variable in REXX, thus you must set values for the NAME, NAME_LENGTH and FILE_OPTIONS fields in addition to declaring them.