In a string descriptor, the second byte of the header indicates the string type (bit, character or graphic as well as nonvarying, varying or varyingz).
In a string descriptor for a nonvarying bit string, the third byte of the header gives the bit offset.
In a string descriptor for a CHARACTER string, the third byte of the header encodes the compiler CODEPAGE option.
In a string descriptor for a varying string, the fourth byte has a bit indicating if the string length is held in nonnative format.
In a string descriptor for a character string, the fourth byte also has a bit indicating if the string data is in EBCDIC.
The declare for a string descriptor is:
declare
1 dsc_String based( sysnull() ),
2 dsc_String_Header,
3 * fixed bin(8) unsigned,
3 dsc_String_Type fixed bin(8) unsigned,
3 * union,
4 dsc_String_Codepage ordinal ccs_Codepage_Enum,
4 dsc_String_BitOfs fixed bin(8) unsigned,
3 *,
4 dsc_String_Has_Nonnative_Len bit(1),
4 dsc_String_Is_Ebcdic bit(1),
4 dsc_String_Has_Nonnative_Data bit(1),
4 * bit(5),
2 dsc_String_Length fixed bin(31); /* max length of string */
The possible values for the dsc_String_Type field are:
declare dsc_String_Type_Unset fixed bin(8) value(0), dsc_String_Type_Char_Nonvarying fixed bin(8) value(2), dsc_String_Type_Char_Varyingz fixed bin(8) value(3), dsc_String_Type_Char_Varying2 fixed bin(8) value(4), dsc_String_Type_Bit_Nonvarying fixed bin(8) value(6), dsc_String_Type_Bit_Varying2 fixed bin(8) value(7), dsc_String_Type_Graphic_Nonvarying fixed bin(8) value(9), dsc_String_Type_Graphic_Varyingz fixed bin(8) value(10), dsc_String_Type_Graphic_Varying2 fixed bin(8) value(11), dsc_String_Type_Widechar_Nonvarying fixed bin(8) value(13), dsc_String_Type_Widechar_Varyingz fixed bin(8) value(14), dsc_String_Type_Widechar_Varying2 fixed bin(8) value(15);