In general, TRANSLATE AND TEST is executed by the
use of anEXECUTE instruction, which supplies the length
specification from a general In this way, a complete
statement scan can be performed with a singleTRANSLA TE
AND TEST instruction repeated over and over by means ofEXECUTE. In the example, after the first execution of
TRT, register 1 contains the address of the last argument
byte translated. It is then a simple matter to subtract this
address from the address of the last argument byte (301D)
to produce a length specification. This length minus one is
placed in the register that is referenced as the RI field of
theEXECUTE instruction. (Because the length code in the
machine format is one less than the total number of bytes in
the field, one must be subtracted from the computed length.)
The second-operand address of theEXECUTE instruction
points to the TRANSLATE AND TEST instruction, which
must now appear in the following format:
Machine FormatOp Code L B1
°100 00 I 001 000 Assembler Format Op Code 01 (L, B
1
), 02 (B
2
)
TRT1(0,1),0(15) Now the entire argument field can be scanned, stopping to
examine those characters of special interest, without having
to modify any of the instructions already written. After a
stop is made to examine a character, only a new length need
be computed before continuing the scan.
Unpack (UNPK)
Assume that storage locations 2501-2503 contain a signed,
packed-decimal field that is to be unpacked and placed in
storage locations1000-1004. Also assume:
Register 12 contains00 00 10 00 Register 13 contains 00 00 25 00 Storage locations 2501-2503 contain 12 34 5D
The initial contents of storage locations1000-1004 are not
significant
After the instruction
Machine Format
F3I 4 I 2 I c 000 001 Assembler Format Op Code 01 (L
1
, B,), 02 (L
2
, B
2
)
UNPK 0(5,12),1(3,13)
is executed, storage locations1000-1004 contain F 1 F2 F3
F4 D5.DECIMAL INSTRUCTIONS Add Decimal (AP)
Assume that the signed, packed-decimal field at storage loca
tions500-503 is to be added to the signed, packed-decimal
field at locations2000-2002. Also assume:
Register 12 contains00 00 20 00 Register 13 contains 00 00 04 FD
Storage locations2000-2002 contain 38 46 OD (a negative
number)
Storage locations500-503 contain 01 12 34 5C (a positive
number)
After the instruction
Machine FormatOp Code L1 L2 B, 01 B2 02 1--1 -2 -r-,-3-"',-C-'--' 000-"---, Assembler Format Op Code 01 (L
1
, B
1
), 02 (L
2
, B2)
AP0(3,12),3(4,'3) is executed, storage locations 2000-2002 contain 73 88 5C; condition code 2 is set to indicate that the sum is positive.
Note that:
1. Although the second-operand field is larger than the first
operand field, no overflow interruption occurs because
the result can be entirely contained within the first
operand field.
2. Because the two numbers had different signs, they wereif!. effect subtracted.
CompareDecimal (CP)
Assume that the signed, packed-decimal contents of storage
locations700-703 are to be algebraically compared with the
signed, packed-decimal contents oflocation500-503. Also
assume:
Register 12 contains00 00 06 00 Register 13 contains 00 00 04 00 Storage locations 700-703 contain 17 25 35 6D
Storage locations500-503 contain 06 72 14 2D
After the instruction
Machine FormatOp Code L, L2 B1 100 Assembler Format Op Code 01 (L
1
, B
1
), 02 (L
2
, B2)CP X'100'(4,12),X'100'(4,13) 100 is executed, condition code 1 is set, indicating that the first
operand (the contents of locations700-703) is lower than
the second.
Appendix I. Number Representation and Instruction-Use Examples305
use of an
specification from a general
statement scan can be performed with a singleTRANSLA TE
AND TEST instruction repeated over and over by means of
TRT, register 1 contains the address of the last argument
byte translated. It is then a simple matter to subtract this
address from the address of the last argument byte (301D)
to produce a length specification. This length minus one is
placed in the register that is referenced as the RI field of
the
machine format is one less than the total number of bytes in
the field, one must be subtracted from the computed length.)
The second-operand address of the
points to the TRANSLATE AND TEST instruction, which
must now appear in the following format:
Machine Format
°1
1
), 02 (B
2
)
TRT
examine those characters of special interest, without having
to modify any of the instructions already written. After a
stop is made to examine a character, only a new length need
be computed before continuing the scan.
Unpack (UNPK)
Assume that storage locations 2501-2503 contain a signed,
packed-decimal field that is to be unpacked and placed in
storage locations
Register 12 contains
The initial contents of storage locations
significant
After the instruction
Machine Format
F3
1
, B,), 02 (L
2
, B
2
)
UNPK 0(5,12),1(3,13)
is executed, storage locations
F4 D5.
Assume that the signed, packed-decimal field at storage loca
tions
field at locations
Register 12 contains
Storage locations
number)
Storage locations
number)
After the instruction
Machine Format
1
, B
1
), 02 (L
2
, B2)
AP
Note that:
1. Although the second-operand field is larger than the first
operand field, no overflow interruption occurs because
the result can be entirely contained within the first
operand field.
2. Because the two numbers had different signs, they were
Compare
Assume that the signed, packed-decimal contents of storage
locations
signed, packed-decimal contents oflocation
assume:
Register 12 contains
Storage locations
After the instruction
Machine Format
1
, B
1
), 02 (L
2
, B2)
operand (the contents of locations
the second.
Appendix I. Number Representation and Instruction-Use Examples








































































































































































































































































































































