CABxx (Compare and Branch)

Free-Form Syntax (not allowed - use other operation codes, such as LEAVE, ITER, and RETURN)
Code Factor 1 Factor 2 Result Field Indicators
CABxx Comparand Comparand Label HI LO EQ

The CABxx operation compares factor 1 with factor 2. If the condition specified by xx is true, the program branches to the TAG or ENDSR operation associated with the label specified in the result field. Otherwise, the program continues with the next operation in the sequence. If the result field is not specified, the resulting indicators (positions 71-76) are set accordingly, and the program continues with the next operation in the sequence.

You can specify conditioning indicators. Factor 1 and factor 2 must contain a literal, a named constant, a figurative constant, a table name, an array element, a data structure name, or a field name. Factor 1 and factor 2 must be of the same type. The label specified in the result field must be associated with a unique TAG operation and must be a unique symbolic name.

A CABxx operation in the cycle-main procedure can specify a branch:

A CABxx operation in a subprocedure can specify a branch:

The CABxx operation cannot specify a branch from outside a subroutine to a TAG or ENDSR operation within that subroutine.

Attention!

Branching from one point in the logic to another may result in an endless loop. You must ensure that the logic of your program or procedure does not produce undesirable results.

Resulting indicators are optional. When specified, they are set to reflect the results of the compare operation. For example, the HI indicator is set when F1>F2, LO is set when F1<F2, and EQ is set when F1=F2.

See Compare Operations for the rules for comparing factor 1 with factor 2.

For more information, see Branching Operations.

Figure 278. CABxx Operations
*...1....+....2....+....3....+....4....+....5....+....6....+....7...+....
CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq....
 *
 *         The field values are:
 *         FieldA = 100.00
 *         FieldB = 105.00
 *         FieldC = ABC
 *         FieldD = ABCDE
 *
 *          Branch to TAGX.
C     FieldA        CABLT     FieldB        TAGX
 *
 *          Branch to TAGX.
C     FieldA        CABLE     FieldB        TAGX
 *
 *          Branch to TAGX; indicator 16 is off.
C     FieldA        CABLE     FieldB        TAGX                     16
 *
 *          Branch to TAGX; indicator 17 is off, indicator 18 is on.
C     FieldA        CAB       FieldB        TAGX                 1718
 *
 *          Branch to TAGX; indicator 19 is on.
C     FieldA        CAB       FieldA        TAGX                      19
 *
 *          No branch occurs.
C     FieldA        CABEQ     FieldB        TAGX
 *
 *          No branch occurs; indicator 20 is on.
C     FieldA        CABEQ     FieldB        TAGX                   20
 *
 *          No branch occurs; indicator 21 is off.
C     FieldC        CABEQ     FieldD        TAGX                 21
C                   :
C     TAGX          TAG


[ Top of Page | Previous Page | Next Page | Contents | Index ]