ESP Workload Automation

 View Only
  • 1.  How can I trigger an event upon successful completion of a job?

    Posted Jan 24, 2019 04:11 PM

    Currently code looks like this:

     

    JOB DXRFADSD                                 
      CCCHK RC(1:9999) OK CONTINUE               
      RUN ANY                                    
      NOTIFY JOBEND EVENT(DXGROUP.DXRFADSD_JOBEND)
      RELEASE DXRFALTU                           
    ENDJOB                                       

     

    What I am trying to do is ensure that a list of jobs continues to run even if this job fails, which is why I have the OK CONTINUE, at least that is my understanding of its use. I need the event DXGROUP.DXRFADSD_JOBEND to only be triggered upon successful completion of job DXRFADSD. I am getting mixed search results as to whether this is the correct way to go.

     

    Thanks,

    Frank



  • 2.  Re: How can I trigger an event upon successful completion of a job?

    Posted Jan 24, 2019 04:48 PM

    Hi Frank, 

    First I would like to verify what you are trying to accomplish. 

    If job DXRFADSD gets any return code you want it to end successfully on the screen. 

    If DXRFADSD ends with a 0 then you want to trigger an event. 

     

    Does this sound correct? 

     

    I will start with the simple case.

    DPTST001 will always end successfully. Note 4095 is the highest RC possible. 

     

    DPTST002 and DPTST003 only run if DPTST001 ends with a 0  If DPTST001 gets a return code > 0 then DPTST002 and DPTST003 will BYPASS 

     

    JOB DPTST001
    RUN DAILY
        CCCHK RC (0:4095) OK CONTINUE
        RELEASE ADD(DPTST002) COND(RC(0))
    ENDJOB

    JOB DPTST002
        RUN DAILY
        RELEASE DPTST003
    ENDJOB

    JOB DPTST003
        RUN DAILY
    ENDJOB

     

    You mentioned triggering an EVENT...... That would look something like this. 

     

    JOB DPTST001 
        RUN DAILY 
        CCCHK RC (0:4095) OK CONTINUE 
        RELEASE ADD(DPTST002) COND(RC(0)) 
    ENDJOB 

     

    JOB DPTST002 LINK PROCESS
    RUN DAILY 
    ESP TRIGGER DXGROUP.DXRFADSD_JOBEND
    ENDJOB 

     

    IMPORTANT NOTE:

    In this scenario if DPTST001 gets a SOC7 it is going to fail and stop these jobs. The above scenario is only coded for return code failures. 



  • 3.  Re: How can I trigger an event upon successful completion of a job?

    Posted Jan 25, 2019 09:18 AM

    Good morning,

     

    Partially correct, if DXRFADSD gets a return code greater than 0 I want it to fail, but I still want it to release the next job in line. If it gets a return code of 0, then I also want it to trigger an event. I am guessing I need to change from OK CONTINUE to FAIL CONTINUE. Here is what I have now:

     

    NOTIFY OVERDUE FAILURE ABEND MAILBOX(SECURITY)

     

    JOB DXRFADSD

    RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      RELEASE ADD(RELFADSD) COND(RC(0))

      RELEASE DXRFALTU

    ENDJOB

     

    JOB DXRFALTU

    RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      RELEASE ADD(RELFALTU) COND(RC(0))

      RELEASE DXRFCERT

    ENDJOB

     

    JOB DXRFCERT

    RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      RELEASE DXRFCGRP

    ENDJOB

     

    JOB DXRFCGRP

    RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      RELEASE ADD(RELFCGRP) COND(RC(0))

      RELEASE DXRFPERM

    ENDJOB

     

    JOB DXRFPERM

    RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      RELEASE DXRFRDEF

    ENDJOB

     

    JOB DXRFRDEF

    RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      RELEASE DXRFSITE

    ENDJOB

     

    JOB DXRFSITE

    RUN ANY

      CCCHK RC(1:4095) FAIL

    ENDJOB

     

    JOB RELFADSD

    RUN ANY

      ESP TRIGGER DXGROUP.DXRFADSD_JOBEND

    ENDJOB

     

    JOB RELFALTU

    RUN ANY

      ESP TRIGGER DXGROUP.DXRFALTU_JOBEND

    ENDJOB

     

    JOB RELFCGRP

    RUN ANY

      ESP TRIGGER DXGROUP.DXRFCGRP_JOBEND

    ENDJOB

     

     

    So basically I need the following jobs to run on a daily basis no matter what their return code is:

    DXRFADSD

    DXRFALTU

    DXRFCERT

    DXRFCGRP

    DXRFPERM

    DXRFRDEF

    DXRFSITE

     

     

    Should the following jobs have a return code of 0, they should each trigger a separate event:

    DXRFADSD

    DXRFALTU

    DXRFCGRP



  • 4.  Re: How can I trigger an event upon successful completion of a job?
    Best Answer

    Posted Jan 25, 2019 11:26 AM

    Hi Frank, 

    NOTES - A couple of notes so we are on the same page. 

    1) In the statement below the CONTINUE means the next step in the JCL will run. This is not related to the next job in the schedule. 

    "CCCHK RC(1:4095) FAIL CONTINUE" 

     

    2) To make the next job run the RELEASE statement needs to be coded correctly.  To make it release whether it completes successfully or not(unconditionally) it should look like the statement below. 

    RELEASE ADD(DPTST002(U))

     

    3) I added the statement below to cover the default case. 

    CCCHK RC (0) OK CONTINUE

     

    4) I am assuming that someone is going to come back and restart the failed jobs. It would not be good to require someone to clean this up manually each time a job fails. 

     

    I think it would look closer to the schedule below. 

     

    NOTIFY OVERDUE FAILURE ABEND MAILBOX(SECURITY)

    JOB DXRFADSD

      RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      CCCHK RC (0) OK CONTINUE

      RELEASE ADD(DXRFALTU(U))

    ENDJOB

     

    JOB DXRFALTU

    RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      CCCHK RC (0) OK CONTINUE

      RELEASE ADD(DXRFCERT(U))

    ENDJOB

     

     

    JOB DXRFCERT

    RUN ANY

      CCCHK RC(1:4095) FAIL CONTINUE

      CCCHK RC (0) OK CONTINUE

      RELEASE ADD(DXRFCGRP(U))

    ENDJOB

     

    .........

    ..........

    ........

    For these jobs the TRIGGER can't be in the same job since you want to trigger it after it ends and only in the case of RC=0 

    JOB RELFADSD

    RUN ANY

      RELEASE ADD(LINK1) COND(RC(0))

    ENDJOB

     

    JOB LINK1

      RUN ANY

      ESP TRIGGER DXGROUP.DXRFADSD_JOBEND

    ENDJOB

     



  • 5.  Re: How can I trigger an event upon successful completion of a job?

    Posted Jan 25, 2019 11:40 AM

    Thank you. I will get it coded up and start testing and let you know how it goes.



  • 6.  Re: How can I trigger an event upon successful completion of a job?

    Posted Jan 31, 2019 02:23 PM

    Works great, thank you so much!



  • 7.  Re: How can I trigger an event upon successful completion of a job?

    Posted Jan 31, 2019 02:27 PM

    Great!!!.... Thanks for the update......