Table of Contents

Compare Alpha (CPA)/OP=45

Format

OP AF BF A Syllable B Syllable

OP = 45

AF is the length of the A field. A value of 00 is equal to a length of 100 units (digits or characters as specified by the A address controller). AF may be indirect or may indicate that the A syllable is a literal.
BF is the length of the B field. A value of 00 is equal to a length of 100 units (digits or characters as specified by the B address controller). BF may be indirect.

The A Syllable is the address of the first data field to be compared. Address may be indexed, indirect or extended. The final address controller data type must be UN or UA and must be the same as the B address controller or cause an Illegal Instruction (IEX = 03) fault.

The B Syllable is the address of the second data field to be compared. Address may be indexed, indirect or extended. The final address controller data type must be UN or UA and must be the same as the A address controller or cause an Illegal Instruction (IEX = 03) fault.

Function

The Compare Alpha instruction compares the characters (or digits) in the two data fields in memory according to the binary collating sequence and sets the comparison flags accordingly.

If the field lengths are unequal, and the data types are UA, pad the shorter field with trailing blanks (EBCDIC code 40) to equal the length of the longer field. If the data types are UN pad the shorter field with trailing zeros.

The values in memory are unchanged.

Comparison Flags

Set the Comparison Flags to HIGH if the binary value of the A data field is greater than that of the B data field. EQUAL if the two data fields have exactly the same bit patterens (including trailing blanks or zeros) and LOW if the binary value of the A data field is less than that of the B data field.

Overlap

There are no overlap restrictions for this instruction.

Examples

Example (1) Compare two Alpha data fields

OP AFBF A Syllable B Syllable
45 0503 A Field (UA) B Field (UA)
                    BEFORE              AFTER
   A Field         C1E3E24040        unchanged
   B Field         C1E3E2            unchanged
   Comparison Flags   nn                EQUAL

Example (2) Compare two Alpha data fields

OP AFBF A Syllable B Syllable
45 0202 A Field (UA) B Field (UA)
                    BEFORE              AFTER
   A Field           C1D5             unchanged
   B Field           C2D5             unchanged
   Comparison Flags   nn                 LOW