Contents - Index


 

Use the ProcIfD command within a procedure to only process the next line in the procedure if a specified condition is true.  If the condition is not true, the following line will be ignored.

 

ProcIfD may also be entered as IfD.

 

Required Operands

 

OPER1 is the name of a previously declared variable.

 

COND is the condition to test for.  One of the following must be specified:

 

        LT    less than

        LE    less than or equal

        EQ    equal

        NE    not equal

        GE    greater than or equal

        GT    greater than

 

 

OPER2 is the name of a previously declared variable.

 

If the OPER1 variable has type CHAR, its value is compared alphamerically with the OPER2 value.  If the two comparison values are not the same length, the shorter one is padded on the right with blanks to cause the lengths to be the same.

 

If the OPER1 and OPER2 variables have type NUM, their values are compared algebraically.

 

If the OPER1 and OPER2 variables have different types, the comparison cannot succeed.  Message BICIFDXB will be returned with an "SV" return code.

 

Use the ProcIf command to compare the value of a variable to a literal value or a value created by replacement.

 

Nested ProcIfD commands are not supported but can easily be simulated with a combination of ProcIfDs and ProcGotos.

 

Return Codes

 

The ProcIfD command does not change the return code.

 

Examples

 

If the value of variable MINUEND is less than the value of variable SUBTRHND, exit the procedure with an error message:

 

 ------------------------------------------------------------------------

 DECLARE MINUEND,NUM,9,F

 DECLARE SUBTRHND,NUM,9,F

 PARSE MINUEND,SUBTRHND

 IFD MINUEND,LT,SUBTRHND

     EXIT SV,'(SUBTESTA) ** RESULT CANNOT BE NEGATIVE **'

 ------------------------------------------------------------------------