characters from the EBCDIC code. For example, in EBCDIC the above two data fields are:
Field 1JOHNSON ,A.B.
Field 2 JOHNSON,A.C.Condition code 1 tells us that A. B. JOHNSON precedes
A.C. JOHNSON, thus placing the names in the correct
alphabetic order.
Comparelogical Characters Under Mask (ClM)
TheCLM instruction provides a means of comparing selected
bytes of a word contained in a general register to a contig
uous field of bytes in main storage. The M3 field of theCLM instruction is a four-bit mask that selects zero through four
bytes from a general register, each mask bit corresponding
left to right with a selected register byte. In the compari
son, the selected register bytes are treated as a contiguous
field, and the operands are considered as binary unsigned
quantities, with all codes valid. The operation proceeds
left to right. For example, assume that:
Three bytes starting at storage location10200 contain FO BC 7B
Register 12 contains10 000 Register 6 contains FO BC 5C 7B
Execution of the instruction
Machine Format200 Assembler Format Op Code R
1
, M
3
, D2 (8
2
)ClM 6,8'1101',X'200'(12) produces the following result:
Register 6:FO Mask (D) FO Three bytes starting at location 10200 8C 8C 5C o
78
1
78
Result:Condition code 0 is set (selected bytes are equal,
or mask is zero). Register 6 and bytes in main
storage are unchanged.Other condition codes would indicate:
Condition Code,'
1 Selected field of first operand (register contents)
is less than second operand (storage locations)
2 Selected field of first operand is greater than
second operand
3
Comparelogical long (ClCL)
TheCLCL instruction is used to logically compare two
operands in main storage. Each operand can be up to
16,777,215 bytes in length. Two pairs of even-odd general
registers are used to locate the operands and to control the
execution of theCLCL instruction, which can be inter
rupted in progress. The first register of each pair must be
an even register, and it is used to contain the storage location
of the byte currently being compared in each operand. The
odd register of each pair contains the length of the operand
it covers, and the high-order byte of the second-operand
odd register contains a padding character which is used to
logically extend a shorter operand to the same length as a
longer operand. The following illustrates the assignment of
registers forCLCL: R1 (Even) First-Operand Address I 0 8 31
R1+1(Odd) First-Operand length I 0 8 31
R2 (Even)Second-Operand Address 0 8 31
R2+1(Odd) Pad Char. Second-Operand length
o 8 31
The following instructions set up two register pairs to
control a text-string comparison. For example, assume:Operand 1
Address:20800 (hex)
Length:100 (dec) Operand 2
Address:20AOO (hex)
Length: 132 (dec)Pad Character
AddIess:20003 (hex)
Length: 1
Value:40 (hex)
Register 12 contains00 02 00 00 The setup instructions are:
LA4,X'800' (12) Point register 4 to the start of the first
operand
LA5,100 Set register 5 to the length of first operand
LA 8,X'AOO'(12)Point register 8 to the start of second
operand
LA 9,132 Set register 9 to the length of second
operand
ICM 9,B'1000',3(12) Insert padding character (blank) into byte
o of register 9.
The register pair 4-5 is now covering the first operand.
Bits 8-31 of register 4 contain the storage location of the
start of anEBCDIC text string, and bits 8-31 of register 5
contain the length of the string, in this case100 bytes.
Appendix I. Number Representation and Instruction-Use Examples 295
Field 1
Field 2 JOHNSON,A.C.
A.
alphabetic order.
Compare
The
bytes of a word contained in a general register to a contig
uous field of bytes in main storage. The M3 field of the
bytes from a general register, each mask bit corresponding
left to right with a selected register byte. In the compari
son, the selected register bytes are treated as a contiguous
field, and the operands are considered as binary unsigned
quantities, with all codes valid. The operation proceeds
left to right. For example, assume that:
Three bytes starting at storage location
Register 12 contains
Execution of the instruction
Machine Format
1
, M
3
, D2 (8
2
)
Register 6:
78
1
78
Result:
or mask is zero). Register 6 and bytes in main
storage are unchanged.
Condition Code,'
1 Selected field of first operand (register contents)
is less than second operand (storage locations)
2 Selected field of first operand is greater than
second operand
3
Compare
The
operands in main storage. Each operand can be up to
16,777,215 bytes in length. Two pairs of even-odd general
registers are used to locate the operands and to control the
execution of the
rupted in progress. The first register of each pair must be
an even register, and it is used to contain the storage location
of the byte currently being compared in each operand. The
odd register of each pair contains the length of the operand
it covers, and the high-order byte of the second-operand
odd register contains a padding character which is used to
logically extend a shorter operand to the same length as a
longer operand. The following illustrates the assignment of
registers for
R1+1
R2 (Even)
R2+1
o 8 31
The following instructions set up two register pairs to
control a text-string comparison. For example, assume:
Address:
Length:
Address:
Length: 132 (dec)
AddIess:
Length: 1
Value:
Register 12 contains
LA
operand
LA
LA 8,X'AOO'(12)
operand
LA 9,132 Set register 9 to the length of second
operand
ICM 9,B'1000',3(12) Insert padding character (blank) into byte
o of register 9.
The register pair 4-5 is now covering the first operand.
Bits 8-31 of register 4 contain the storage location of the
start of an
contain the length of the string, in this case
Appendix I. Number Representation and Instruction-Use Examples 295








































































































































































































































































































































