$BINARYw. Informat

Converts binary data to character data.

Category: Character

Syntax

$BINARYw.

Syntax Description

w

specifies the width of the input field. Because eight bits of binary information represent one character, every eight characters of input that $BINARYw. reads becomes one character value stored in a variable.

If w< 8, $BINARYw. reads the data as w characters followed by 0s. Thus, $BINARY4. reads the characters 0101 as 01010000, which converts to an EBCDIC & or an ASCII P. If w> 8 but is not a multiple of 8, $BINARYw. reads up to the largest multiple of 8 that is less than w before converting the data.
Default 8
Range 1–32767

Details

The $BINARYw. informat does not interpret actual binary data, but it converts a string of characters that contains only 0s or 1s as if it is actual binary information. Therefore, use only the character digits 1 and 0 in the input, with no embedded blanks. $BINARYw. ignores leading and trailing blanks.
To read representations of binary codes for unprintable characters, enter an ASCII or EBCDIC equivalent for a particular character as a string of 0s and 1s. The $BINARYw. informat converts the string to its equivalent character value.

Comparisons

  • The BINARYw. informat reads eight characters of input that contain only 0s or 1s as a binary representation of one byte of numeric data.
  • The $HEXw. informat reads hexadecimal characters that represent the ASCII or EBCDIC equivalent of character data.

Example

input @1 name $binary16.;
Data Line
Result
----+----1----+----2
ASCII
EBCDIC
0100110001001101
LM
<(