Byte String Conversion (BS)

Byte String Conversion (BS)

Top  Previous  Next

 

The BS conversion code transforms ECS data to a byte string.

 

The full format of this conversion code is

 

BS{L | H}

 

 

Used with OCONV(), the BS conversion code transforms ECS data from its internal 16-bit character form to a series of byte pairs, each stored as two characters with values in the range 0 to 255. Although intended for use on an ECS mode system, this conversion code is also available for use on a non-ECS system where the high order byte of each converted character will always be zero.

 

Used with ICONV(), the BS conversion code transforms a series of byte pairs into ECS characters. If the source data contains characters with values greater than 255, the STATUS() value after conversion will be set to 3. This conversion code is also available for use on a non-ECS system where a non-zero high order byte in the input data will also set a STATUS() value of 3.

 

The default action of the BS conversion is to adopt the byte ordering of the system on which it is executed such that a character with Unicode code point value U+1234 would correspond to a byte pair hexadecimal 12 followed by hexadecimal 34 on a high byte first (big-endian) system or the reverse on a low byte first (little endian) system. The optional L or H suffix on the conversion code forces conversion using low byte first or high byte first ordering respectively.

 

 

Example

 

S = ECHAR(0x03A3):'ABC'   ;* Greek Sigma followed by ABC

X = OCONV(S, 'BSH')

DISPLAY OCONV(X, 'MX0C')

 

The above program fragment displays

  03A3004100420043