Convert Character to BSC (CVTCB)

Instruction Syntax

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:

  • Branch Form–Branch point, instruction pointer, relative instruction number, or absolute instruction number.
  • Indicator Form–Numeric variable scalar or character variable scalar.

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

  • Source exhausted–All of the bytes in the source operand have been converted into the receiver operand.
  • Receiver overrun–An overrun condition in the receiver operand was detected before all of the bytes in the source operand were processed.

Authorization Required

  • None

Lock Enforcement

  • None

Exceptions

  • 06 Addressing
    • 0601 Space Addressing Violation
    • 0602 Boundary Alignment
    • 0603 Range
  • 08 Argument/Parameter
    • 0801 Parameter Reference Violation
  • 10 Damage Encountered
    • 1004 System Object Damage State
    • 1044 Partial System Object Damage
  • 1C Machine-Dependent
    • 1C03 Machine Storage Limit Exceeded
  • 20 Machine Support
    • 2002 Machine Check
    • 2003 Function Check
  • 22 Object Access
    • 2201 Object Not Found
    • 2202 Object Destroyed
    • 2203 Object Suspended
    • 2208 Object Compressed
    • 220B Object Not Available
  • 24 Pointer Specification
    • 2401 Pointer Does Not Exist
    • 2402 Pointer Type Invalid
  • 2C Program Execution
    • 2C04 Branch Target Invalid
  • 2E Resource Control Limit
    • 2E01 User Profile Storage Limit Exceeded
  • 32 Scalar Specification
    • 3201 Scalar Type Invalid
  • 36 Space Management
    • 3601 Space Extension/Truncation
  • 38 Template Specification
    • 3801 Template Value Invalid
  • 44 Protection Violation
    • 4401 Object Domain or Hardware Storage Protection Violation
    • 4402 Literal Values Cannot Be Changed