ESP Workload Automation

 View Only
  • 1.  coding IF/ORs

    Posted Oct 21, 2019 03:18 PM
    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

    Broadcom Employee
    Posted Oct 21, 2019 05:21 PM
    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