CA Workload Automation ESP Edition

Expand all | Collapse all

coding IF/ORs

Jump to Best Answer
  • 1.  coding IF/ORs

    Posted 24 days ago
    Is there an easier way to code the following ... this nested IF works ...

    Example, Of the 10 calling the template, I want 3 to pull the JCL from a different JCLLIB for a specific time period.

    **********  *******************
    APPL PHS1TEMP JOB_ANCESTOR_WAIT(ANY)
         JCLLIB 'V914177.ESP'

    TEMPLATE PHS1TMP (1,JOBNAME)

    JOB %JOBNAME

    RUN TODAY
    /*
    IF %JOBNAME='$PHS1FOU.WEEKLY' OR -
        %JOBNAME='$PHS1FIV.WEEKLY' OR -
        %JOBNAME='$PHS1SIX.WEEKLY' THEN DO
         IF DAYS_FROM('OCT 18,2019') GE 0 -
            AND DAYS_TO('DEC 01,2019') GE 0 -
            THEN DO    
            DATASET 'V914177.JCL'
          ENDDO
    ENDDO
    /*
    ENDJOB

    ENDTEMPL

    PHS1TMP $PHS1ONE.WEEKLY
    PHS1TMP $PHS1TWO.WEEKLY
    PHS1TMP $PHS1THR.WEEKLY
    PHS1TMP $PHS1FOU.WEEKLY
    PHS1TMP $PHS1FIV.WEEKLY
    PHS1TMP $PHS1SIX.WEEKLY
    PHS1TMP $PHS1SEV.WEEKLY
    PHS1TMP $PHS1EIG.WEEKLY
    PHS1TMP $PHS1NIN.WEEKLY
    PHS1TMP $PHS1TEN.WEEKLY



  • 2.  RE: coding IF/ORs
    Best Answer

    Posted 24 days ago
    Hi Phil,

    Your coding looks pretty good!

    You could put all conditions in one layer, but nested-IF logic can have better performance, since if the top layer is false, other layers won't be checked.

    Also if there is only one statement, no need to use DO-ENDDO, like:
    IF DAYS_FROM('OCT 18,2019') GE 0 -
            AND DAYS_TO('DEC 01,2019') GE 0  THEN -
            DATASET 'V914177.JCL'

    Hope this helps,

    Lucy