MFBSI supports a maximum of 100 nested %%IF levels.
This example shows %%IF, %%ELSE, and %%ENDIF variable substitution:
Statement/Expression | Resolves as... |
---|---|
//* %%SET %%STEP=STEP1 //* %%IF %%STEP EQ STEP1 //STEP1 EXEC PGM=IEFBR14 //* => To be executed //SYSOUT DD SYSOUT=* //* %%ELSE //STEP2 EXEC PGM=IEFBR14 //* => To be excluded //SYSOUT DD SYSOUT=* //* %%ENDIF //* => Always executed //STEP3 EXEC PGM=IEFBR14 //* => Always executed //SYSOUT DD SYSOUT=* |
//* %%SET %%STEP=STEP1 //* %%IF STEP1 EQ STEP1 //STEP1 EXEC PGM=IEFBR14 //* => To be executed //SYSOUT DD SYSOUT=* //* %%ELSE //* %%ENDIF //* => Always executed //STEP3 EXEC PGM=IEFBR14 //* => Always executed //SYSOUT DD SYSOUT=* |
//* %%IF %%STEP NE STEP1 //STEP1 EXEC PGM=IEFBR14,PARM='%%DATE' //* => To be excluded //SYSOUT DD SYSOUT=* //* %%ELSE //STEP2 EXEC PGM=IEFBR14,PARM='%%ODATE' //* => To be executed //SYSOUT DD SYSOUT=* //* %%ENDIF //* => Always executed //STEP3 EXEC PGM=IEFBR14,PARM='%%RDATE' //SYSOUT DD SYSOUT=* |
//* %%IF STEP1 NE STEP1 //* %%ELSE //STEP2 EXEC PGM=IEFBR14,PARM='110716' //* => To be executed //SYSOUT DD SYSOUT=* //* %%ENDIF //* => Always executed //STEP3 EXEC PGM=IEFBR14,PARM='110716' //SYSOUT DD SYSOUT=* |
//* %%SET %%STEP=STEP2 //* %%IF %%STEP EQ STEP1 //* %%ELSE //STEP1 EXEC PGM=IEFBR14 //* => To be executed //SYSOUT DD SYSOUT=* //* %%ENDIF //STEP2 EXEC PGM=IEFBR14 //* => Always executed //SYSOUT DD SYSOUT=* |
//* %%SET %%STEP=STEP2 //* %%IF STEP2 EQ STEP1 //* %%ELSE //STEP1 EXEC PGM=IEFBR14 //* => To be executed //SYSOUT DD SYSOUT=* //* %%ENDIF //STEP2 EXEC PGM=IEFBR14 //* => Always executed //SYSOUT DD SYSOUT=* |