Page of G A22-7 0004 Revis.ed September 1, 1975
By TNL: GN22-0498
The eight-bit bytes of the first operand are used as
arguments to reference the list designated by the
second-operand address.
The L field applies only to the first operand.
Each eight-bit function byte thus selected from
the list is used to determine the continuation of the
operation. When the function byte is a zero, the
operation proceeds by fetching and translating the
next argument byte. When the function byte is
nonzero, the operation is completed by inserting the
relat.ed argument address in general register 1 and by
inserting the function byte in general register 2.
The bytes of the first operand are selected one by
one for translation, proceeding from left to right.
The first operand remains unchanged in storage.
Fetching of the function byte from the list is per­
formed as in TRANSLATE. The function byte re­
trieved from the list is inspected for the all-zero
combination.
When the function byte is zero, the operation
proceeds with the next operand byte. When the first­
operand field is exhausted before a nonzero function
byte is encountered, the operation is completed by
setting condition code O. The contents of general
registers 1 and 2 remain unchanged. "'hen the function byte is nonzero, the related
argument address is inserted in the low-order 24 bits
of gtmeral register 1. This address points to the ar­ gtim1ent last translated. The high-order eight bits of
register 1 remain unchanged. The function byte is
insetted in the low-order eight bits of general regis­
ter 2. Bits 0-23 of register 2 remain unchanged.
Condition code 1 is set when one or more argu­
ment bytes remain to be translated. Condition code
2 is set if the last function byte is the only nonzero
byte. Resu'iting Condition Code:
o All function bytes are zero
1 Nonzero function byte before the first operand
field is exhausted
2 The last function byte is the only nonzero byte
3 - Pros'ram Exceptiom: Access (fetch, operands 1 and 2)
Programming Note
The instruction TRANSLATE AND TEST may be
used to scan the first operand for characters with
spedal meaning. The second operand, or list, is set
up with all-zero function bytes for those characters
to be skipped over and with nonzero function bytes
for the characters to be detected.
146 System/370 Principles of Operation Unpack I F3 I L, I L2 I B, I o 8 12 16 20 32 36 47
The format of the second operand is changed from
packed to zoned, and the result is placed in the first­
operand location.
The digits and sign of the packed operand are
placed unchanged in the first-operand location, using
the zoned format. Zones with coding of 1111 are
supplied for all bytes except the low-order byte,
which receives the sign of the packed operand. The
operand sign and digits are not checked for valid
codes.
The result is obtained as if the fields were pro­
cessed right to left. The second operand is extended
with high-order zero digits before unpacking, if nec­
essary. If the first-operand field is too short to con­
tain all significant digits of the second operand, the
remaining high-order digits are ignored.
When the operands overlap, the result is obtained
as if the operands were processed one byte at a time
and each result byte were stored immediately after
the necessary operand byte is fetched. The entire
rightmost second-operand byte is used in forming
the first result byte. For the remainder of the field,
information for two result bytes is obtained from a
single second-operand byte, and the high-order digit
of the byte remains available and is not refetched.
Thus, two result bytes are stored immediately after
fetching a single operand byte.
Condition Code:
The code remains unchanged.
Program Exceptions:
Access (fetch, operand 2; store, operand 1)
Programming Notes
A field that is to be unpacked can be destroyed by
improper overlapping. If it is desired to save storage
space for unpacking by overlapping the operand
fields, the low-order position of the first operand
must be to the right of the low-order position of the
second operand by the number of bytes in the sec­
ond operand minus two. If only one or two bytes are . to be unpacked, the low-order positions of the two
operands may coincide.
Data Format. . Zoned Format
Packed Format
Number Representation
Instructions .
ADD DECIMAL. .
COMPARE DECIMAL DIVIDE DECIMAL. EDIT .... EDIT AND MARK. . MULTIPLY DECIMAL. Contents SHIFT AND ROUND DECIMAL. SUBTRACT DECIMAL ZERO AND ADD .
Decimal instructions provide arithmetic, shifting, and
editing operations on decimal data. These instruc­
tions constitute the decimal feature.
Data Format
Decimal operands reside in main storage and may be
in either the zoned or packed format.
Zoned Format
In the zoned format, the rightmost four bits of a
byte are called the numeric (N) and normally com­
prise a code representing a decimal digit. The left­
most four bits of a byte are called the zone (Z), ex­
cept for the rightmost byte of the field, where these
bits may be treated either as a zone or as a sign (S) code.
Packed Format I DID 1 DID 1 DID 1 Dis
In the packed format, each byte contains two deci­
mal digits (D), except for the rightmost byte, which
contains a sign to the right of a decimal digit. The
digit and sign codes each comprise four bits.
Arithmetic and shifting are performed with oper­
ands in the packed format and generate results in
the packed format. Decimal numbers in the zoned,
format are represented as part of an alphameric char­
acter set, which includes also alphabetic and special
Decimal Instructions
147
147
147
148
148
149
149
149 150 152
153
153
154
155
characters. The zoned format is usually produced by
source-document input devices, such as a card read­
er, and is usually used for printing decimal data on
an output device.
The instructions MOVE ZONES and MOVE NUMERICS are provided for operating on data in
the zoned format. Two instructions are provided for
converting data between the zoned and packed for­
mats: the PACK instruction transforms zoned data
into packed data, and UNPACK performs the re­ verse transformation. These four instructions are not
part of the decimal feature and are described in the
chapter" General Instructions." The instructions
EDIT and EDIT AND MARK may also be used to
change data from the packed to the zoned format.
Decimal operands occupy fields in main storage
that start on a byte boundary. For all decimal in­
structions other than EDIT and EDIT AND MARK,
the operands are in the packed format and are com­
posed of one to sixteen 8-bit bytes. For the two edit­
ing instructions, operands of up to 256 bytes in
length can be designated.
F or the decimal arithmetic instructions, the
lengths of the two operands specified in the instruc­
tion need not be the same. If necessary, the oper­
ands are considered to be extended with zeros to
the left of the high-order digit. Results, however,
never exceed the first-operand field size as specified
in the instruction. When a carry or high-order signif­
icant digits are lost because the first-operand field is
too small, a program interruption for decimal over­
flow occurs, provided the decimal-overflow mask bit
is one. For the two editing instructions, only one
operand (the pattern) has an explicitly specified
length; the other operand (the source) is considered
Decimal Instructions 147
Previous Page Next Page