RPG Branching Operations - CASxx (Conditionally Invoke Subroutine)

Description: Compares and invokes subroutine if condition true.

Legacy RPG400 Example:

Compare Value1 to Value2 and if they are EQUAL execute the subroutine called "Subr"

C        Value1   CASEQ Value2       Subr

Compare Value1 to Value2 and if Value1 is GREATER than Value2 execute the subroutine called "Subr"

C        Value1   CASGT Value2       Subr

Compare Value1 to Value2 and if Value1 is LESS than Value2 execute the subroutine called "Subr"

C        Value1   CABLT Value2       Subr

Modern RPGLE Example:

There is no equivalent of Compare and Subroutine. Consider using an IF loop:

if Value1 = Value2;
  exsr SubrEq;
endif;

if Value1 > Value2;
  exsr SubrGt;
endif;

if Value1 < Value2;
  exsr SubrLt;
endif;

... or (my preferred) a SELECT loop with multiple conditions:

select;
 when Value1 = Value2;
    exsr SubrEq;
 when Value1 > Value2;
    exsr SubrGt;
 when Value1 < Value2;
    exsr SubrLt;
endSl;
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>