ILE RPG does not have variables that correspond to the SQL binary
data types.
To create host variables that can be used with these data types,
use the SQLTYPE keyword. The SQL precompiler replaces this declaration with
an ILE RPG language declaration in the output source member. Binary declarations
can be either standalone or within a data structure.
BINARY example
The following declaration:
D MYBINARY S SQLTYPE(BINARY:50)
results in the generation of the following code:
D MYBINARY S 50A
VARBINARY example
The following declaration:
D MYVARBINARY S SQLTYPE(VARBINARY:100)
results in the generation of the following code:
D MYVARBINARY S 100A VARYING
Notes: - For BINARY host variables, the length must be in the range 1 to 32766.
- For VARBINARY host variables, the length must be in the range 1 to 32740.
- BINARY and VARBINARY host variables are allowed to be declared in host
structures.
- SQLTYPE, BINARY, and VARBINARY can be in mixed case.
- SQLTYPE must be between positions 44 to 80.
- When a BINARY or VARBINARY is declared as a standalone host variable,
position 24 must contain the character S and position 25 must be blank.
- The standalone field indicator S in position 24 should be omitted
when a BINARY or VARBINARY host variable is declared in a host structure.