15.7 @@IF Command

The @@IF command is used to test the truth of a condition and then bypass the generation of certain RDML commands only if the condition is true.

The command label of the GOTO parameter must be used on another application template command which is the subject of the GOTO.

                                                         Required 

                                                                  

  @@IF ------ COND ------ *IF  variable  *EQ  value ------------> 

                        | *AND           *GT          |           

                        | *OR            *LT          |           

                        |                *NE          |           

                        |                *GE          |           

                        |                *LE          |           

                        |                             |           

                        ---------- 40 max -------------             

                                                                  

          >---GOTO -------command label -----------------------| 

                                                                  

                                                                  

Parameters

COND

Specifies the condition to be evaluated to test the "truth" of the IF condition. The four parts of the parameter are the relationship (*IF *AND *OR), the variable to be evaluated (e.g. @@CANS001), the relational operator (*EQ *GT *LT *NE *GE *LE) and the literal value used for comparison (which must be of the same type as the variables being evaluated). The variable to be evaluated may be any application template variable.

GOTO

Specifies the label of the command which is to receive control. The label specified in this parameter must be the label of one and only one other command in the function.

Examples

The following examples apply to the @@IF command.

Example 1: If the answer to a question is "NO" then branch to a label to bypass generating some RDML code.

     @@IF        COND((*IF @@CANS001 *EQ NO)) GOTO(LB1)

     Some RDML code

         .

         .

         .

LB1: @@LABEL

 

Example 2: If the user selected more than 1 file then ask the user to select additional fields.

     @@IF       COND((*IF @@TFMX *EQ 1)) GOTO(A25)

     @@CLR_LST  ....

     @@MAK_LSTS ....

     @@MRG_LSTS ....

A25: @@LABEL