Previous Topic: BIT STRING Type

Next Topic: Boolean BIT STRING Access

Standard BIT STRING Access

Standard BIT STRING access deals with the string as a whole, allowing manipulation of the entire component through a single operation, as for most other types.

External Form - Input

Valid external form can be a string of one or more digits, each a 0 or 1. However, where named values are defined for the BIT STRING type, a list of named values, each separated by a plus sign (+) or a minus sign (-), is an acceptable alternative. A named value preceded by a plus sign indicates that the named bit value should be set to true (the bit is set to 1), and a minus sign indicates that the value should be set to false (the bit is set to 0).

External Form - Output

The output format depends upon whether or not named values are defined for the BIT STRING type. Where no named values are defined the output consists of a string of zero or more (always a multiple of 8) digits, each a 0 or 1. Where one or more named values do exist the output is a character string comprised of every named value corresponding to a set bit preceded by a plus sign meaning the value is true (the named bit is 1). The names of bits which are not set are not returned.

Local Form and Behavior

When a string if 0's and 1's are supplied as input, each digit in the input sequence is treated (left to right) as the value of the corresponding bit in that position of the local form data. If the number of bits supplied is not a multiple of 8, then trailing bits are set to zero and padded to a byte boundary. If the component has a fixed length exceeding that of the input string the value is left-aligned, and all unreferenced bytes are set to X'00'. If the component cannot contain the number of input bytes supplied, a data check results.

When a list of named values, each preceded by a plus sign or a minus sign, is supplied as input only the named bits take part in the operation. Each named bit preceded by a plus sign is set to 1 (true), while each bit preceded by a minus sign is set to 0 (false). All other bits in the BIT STRING are unaffected by the input operation.

When fetching the value of a BIT STRING, a named value list is returned if any named values are defined for the type, else a string of 0's and 1's is returned corresponding to the BIT STRING values. When named values are defined, all other bits in the BIT STRING are ignored on output regardless of their value.