RPG Branching Operations - CABxx (Compare and Branch)

Description: Compares factor 1 and 2, branches to tag if condition (xx = EQ, GT, etc.) is true.

Legacy RPG400 Example:

Compare Value1 to Value2 and if they are EQUAL branch (aka GOTO) to the LABEL 

C        Value1   CABEQ Value2       Label

Compare Value1 to Value2 and if Value1 is GREATER than Value2 branch (aka GOTO) to the LABEL 

C        Value1   CABGT Value2       Label

Compare Value1 to Value2 and if Value1 is LESS than Value2 branch (aka GOTO) to the LABEL 

C        Value1   CABLT Value2       Label

Modern RPGLE Example:

There is no equivalent of Compare and Branch because this spaghetti loop style of coding has been deprecated in favour of a neat and more organised style. Perhaps consider putting the code in a subroutine and executing it something like this:

if Value1 = Value2;
  exsr Subroutine;
endif;
if Value1 > Value2;
  exsr Subroutine;
endif;
if Value1 < Value2;
  exsr Subroutine;
endif;
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>