COBOL 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 SQL TYPE IS clause. The SQL precompiler replaces this declaration with a COBOL language structure in the output source member.
>>-01--variable-name--------------------------------------------> .-IS-. .-USAGE--+----+-. >--+---------------+--SQL TYPE IS--+-BINARY---------+--(--length--)--> +-VARBINARY------+ '-BINARY VARYING-' >-- . ---------------------------------------------------------><
The following declaration:
01 MY-BINARY SQL TYPE IS BINARY(200).
Results in the generation of the following code:
01 MY-BINARY PIC X(200).
The following declaration:
01 MY-VARBINARY SQL TYPE IS VARBINARY(250).
Results in the generation of the following structure:
01 MY-VARBINARY. 49 MY-VARBINARY-LENGTH PIC 9(5) BINARY. 49 MY-VARBINARY-DATA PIC X(250).