Copy Bits with Right Arithmetic Shift (CPYBTRAS)


Op Code (Hex) Operand 1 Operand 2 Operand 3
101B Receiver Source Shift control
Operand 1: Character variable or numeric variable scalar.

Operand 2: Character scalar or numeric scalar.

Operand 3: Character(2) scalar or unsigned binary(2) scalar.

Description  The instruction copies the bit string value of the source operand to the bit string defined by the receiver operand with a right arithmetic shift of the source bit string value under control of the shift control operand.

The operation results in copying the shifted bit string value of the source to the bit string of the receiver while padding the receiver with bit values of 0 or 1 depending on the high order bit value of the source, and truncating bit values of the source as is appropriate for the specific operation.

No indication is given of truncation of bit values from the shifted source value. This is true whether the values truncated are 0 or 1.

The operation is performed such that the bit string of the source is considered a signed numeric binary value, with the value of the sign bit of the source conceptually extended on the left an unlimited number of bit string positions, and conceptually extended on the right by an unlimited number of bit string positions of value 0. Additionally, a receiver bit string view (window) with the attributes of the receiver is considered to overlay this conceptual bit string value of the source starting at the leftmost bit position of the original source value. A right arithmetic shift of the conceptual bit string value of the source is then performed according to the shift criteria specified in the shift control operand. No indication is given of truncation of bit values from the shifted conceptual source value. This is true whether the values truncated are 0 or 1. After the shift, the bit string value then contained within the receiver bit string view is copied to the receiver.

Viewing the bit string value of the source and the bit string value copied to the receiver as signed numeric, the sign of the value copied to the receiver will be the same as the sign of the source.

Under some circumstances, such as when the source and receiver have the same length, a right shift of one bit position is equivalent to dividing the signed numeric bit string value of the source by 2 with rounding downward, and assigning a signed numeric bit string equivalent to that result to the receiver. For example, if the signed numeric view of the source bit string is +9, shifting one bit position right yields +4. However if the signed numeric view of the source bit string is -9, shifting one bit position right yields -5.

If all the significant bits of the conceptual source bit string are shifted out of the field, the resulting conceptual bit string value will be all zero bits for positive numbers, and all one bits for negative numbers.

The source and the receiver can be either character or numeric. Any numeric operands are interpreted as logical character strings. Due to the operation being treated as a character string operation, the source operand may not be specified as a signed immediate operand. Additionally, for a source operand specified as an unsigned immediate value, only a 1-byte immediate value may be specified.

The shift control operand may be specified as an immediate operand, as a character(2) scalar, or as a unsigned binary(2) scalar. It provides an unsigned binary value indicating the number of bit positions for which the right logical shift of the source bit string value is to be performed. A zero value specifies no shift.

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

2E Resource Control Limit

32 Scalar Specification

36 Space Management

44 Protection Violation