Convert BSC to Character (CVTBC)

Instruction Syntax

Op Code (Hex) Extender Operand 1 Operand 2 Operand 3 Operand [4-6]
CVTBC 10AF Receiver Controls Source
CVTBCB 1CAF Branch options Receiver Controls Source Branch targets
CVTBCI 18AF Indicator options Receiver Controls Source Indicator targets

Operand 1: Character variable scalar.

Operand 2: Character(3) variable scalar.

Operand 3: Character scalar.

Operand 4-6:

  • 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 CVTBC is 130.
CVTBC (
       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
Completed Record.
0
Source Exhausted.
1
Truncated Record.

The receiver, controls and source parameters correspond to operands 1, 2 and 3 on the CVTBC 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 CVTBC 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 the BSC (binary synchronous communications) compressed format to a character string. The operation converts the source (operand 3) from the BSC compressed format to character 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
  • Source offset
  • Bin(2)
2 2
  • Record separator
  • Char(1)
3
3
--- End ---
 

The source offset specifies the offset where bytes are to be accessed from the source operand. If the source offset is equal to or greater than the length specified for the source operand (it identifies a byte beyond the end of the source operand), a template value invalid (hex 3801) exception is signaled. As output from the instruction, the source offset is set to specify the offset that indicates how much of the source is processed 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 source operand. A value of hex 01 specifies that record separators do not occur in the converted records in the source.

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

The operation begins by accessing the bytes of the source operand located at the offset specified in the source offset. This is assumed to be the start of a record. The bytes of the record in the source operand are converted into the receiver record according to the following algorithm.

The strings to be built in the receiver are contained in the source as blank compression entries and strings of consecutive nonblank characters.

The format of the blank compression entries occurring in the source 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 describing up to 63 compressed blanks. The count of the number of blanks (up to 63) to be decompressed is formed by subtracting hex 40 from the value of the count field. The count field can vary from a value of hex 41 to hex 7F. If the count field contains a value outside of this range, a conversion (hex 0C01) exception is signaled.

Strings of blanks described by blank compression entries in the source are repeated in the receiver the number of times specified by the blank compression count.

Nonblank strings in the source are copied into the receiver intact with no alteration.

If the receiver record is filled with converted data without encountering the end of the source operand, the instruction ends with a resultant condition of completed record. This can occur in two ways. If a record separator was not specified, the instruction ends when enough bytes have been converted from the source to fill the receiver. If a record separator was specified, the instruction ends when a source byte is encountered with that value prior to or just after filling the receiver record. The source offset value locates the byte following the last source record (including the record separator) for which conversion was completed. When the record separator value is encountered, any remaining bytes in the receiver are padded with blanks.

If the end of the source operand is encountered (whether or not in conjunction with a record separator or the filling of the receiver), the instruction ends with a resultant condition of source exhausted. The source offset value locates the byte following the last byte of the source operand. The remaining bytes in the receiver after the converted record are padded with blanks.

If the converted form of a record cannot be completely contained in the receiver, the instruction ends with a resultant condition of truncated record. The offset value for the source locates the byte following the last source byte for which conversion was performed, unless a blank compression entry was being processed. In this case, the source offset is set to locate the byte after the blank compression entry. If the source does not contain record separators, this condition can only occur for the case in which a blank compression entry was being converted when the receiver record became full.

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

Resultant Conditions

  • Completed record–The receiver record has been completely filled with converted data from a source record.
  • Source exhausted–All of the bytes in the source operand have been converted into the receiver operand.
  • Truncated record–The receiver record cannot contain all of the converted data from the source record.

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
  • 0C Computation
    • 0C01 Conversion
  • 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