Convert Character to BSC (CVTCB)


Op Code (Hex) Extender Operand 1 Operand 2 Operand 3 Operand [4-5]
CVTCB 108F
Receiver Controls Source


CVTCBB 1C8F Branch options Receiver Controls Source Branch targets


CVTCB 188F Indicator options Receiver Controls Source Indicator targets
Operand 1: Character variable scalar.

Operand 2: Character(3) variable scalar.

Operand 3: Character scalar.

Operand 4-5:

Bound program access

Built-in number for CVTCB is 131. CVTCB ( receiver : address receiver_length : unsigned binary(4) controls : address source : address source_length : unsigned binary(4) return_code : address of signed binary(4) )

The return_code will be set as follows:

Return code

Meaning

-1

Receiver Overrun.

0

Source Exhausted.

The receiver, controls and source parameters correspond to operands 1, 2 and 3 on the CVTCB operation.

The receiver_length and source_length parameters contain the length, in bytes, of the receiver and source strings. They are expected to contain values between 1 and 32,767.

The return_code parameter is used to provide support for the branch and indicator forms of the CVTCB operation. The user must specify code to process the return_code and perform the desired branching or indicator setting.

Description

This instruction converts a string value from character to BSC (binary synchronous communications) compressed format. The operation converts the source (operand 3) from character to the BSC compressed format under control of the controls (operand 2) and places the result into the receiver (operand 1).

The source and receiver operands must both be character strings.

The controls operand must be a character scalar that specifies additional information to be used to control the conversion operation. It must be at least 3 bytes in length and have the following format:

Offset
Dec Hex
Field Name
Data Type and Length
0 0
Controls operand
Char(3)
0 0
Receiver offset
Bin(2)
2 2
Record separator
Char(1)
3 3
--- End ---

The receiver offset specifies the offset where bytes are to be placed into the receiver operand. If the receiver offset is equal to or greater than the length specified for the receiver operand (it identifies a byte beyond the end of the receiver), a template value invalid  (hex 3801) exception is signaled. As output from the instruction, the receiver offset is set to specify the offset that indicates how much of the receiver has been filled when the instruction ends.

The record separator, if specified with a value other than hex 01, contains the value used to separate converted records in the receiver operand. A value of hex 01 specifies that record separators are not to be placed into the receiver to separate converted records.

Only the first 3 bytes of the controls operand are used. Any excess bytes are ignored.

The source operand is assumed to be one record. The bytes of the record in the source operand are converted into the receiver operand at the location specified in the receiver offset according to the following algorithm.

The bytes of the source record are interrogated to identify the strings of consecutive blank (hex 40) characters and the strings of consecutive nonblank characters which occur in the source record. Only three or more blank characters are treated as a blank string for purposes of conversion into the receiver.

As the blank and nonblank strings are encountered in the source, they are packaged into the receiver.

Blank strings are reflected in the receiver as one or more blank compression entries. The format of the blank compression entries built into the receiver are as follows:

Offset
Dec Hex
Field Name
Data Type and Length
0 0
Blank compression entry
Char(2)
0 0
Interchange group separator
Char(1)
1 1
Count of compressed blanks
Char(1)
2 2
--- End ---

The interchange group separator has a fixed value of hex 1D.

The count of compressed blanks provides for compressing up to 63 blanks. The value of the count field is formed by adding hex 40 to the actual number of blanks (up to 63) to be compressed. The count field can vary from a value of hex 43 to hex 7F.

Nonblank strings are copied into the receiver intact with no alteration or additional control information.

When the end of the source record is encountered, the record separator value if specified is placed into the receiver and the instruction ends with a resultant condition of source exhausted. The receiver offset value locates the byte following the converted record in the receiver. The value of the remaining bytes in the receiver after the converted record is unpredictable.

If the converted form of a record cannot be completely contained in the receiver (including the record separator if specified), the instruction ends with a resultant condition of receiver overrun. The receiver offset remains unchanged. The remaining bytes in the receiver, starting with the byte located by the receiver offset, are unpredictable.

Any form of overlap between the operands on this instruction yields unpredictable results in the receiver operand.

Resultant Conditions

Authorization Required

Lock Enforcement

Exceptions

06 Addressing

08 Argument/Parameter

10 Damage Encountered

1C Machine-Dependent

20 Machine Support

22 Object Access

24 Pointer Specification

2C Program Execution

2E Resource Control Limit

32 Scalar Specification

36 Space Management

38 Template Specification

44 Protection Violation