Binary strings

A binary string is a sequence of bytes. The length of a binary string is the number of bytes in the sequence. A binary string has a CCSID of 65535.

Fixed-length binary strings

All values of a fixed-length binary-string column have the same length. This is determined by the length attribute of the column. The length attribute must be between 1 through 32766 inclusive.

Varying-length binary strings

The types of varying-length binary strings are:

The values of a column with any one of these string types can have different lengths. The length attribute of the column determines the maximum length a value can have.

For a VARBINARY column, the length attribute must be between 1 through 32740 inclusive. For a BLOB column, the length attribute must be between 1 through 2 147 483 647 bytes inclusive. For more information about BLOBs, see Large objects.

Binary-string variables

A variable with a binary string type can be defined in all host languages except REXX, RPG/400(R), and COBOL/400(R).

Although binary strings and FOR BIT DATA character strings might be used for similar purposes, the two data types are not compatible. The BINARY, BLOB, and VARBINARY functions can be used to change a FOR BIT DATA character string into a binary string.