How to stop JOB1 from taking off when JOB2 abends when using NOTWITH statement
search cancel

How to stop JOB1 from taking off when JOB2 abends when using NOTWITH statement

book

Article ID: 50048

calendar_today

Updated On:

Products

ESP Workload Automation

Issue/Introduction

Based on the following set up:

If JOB2 abends will that stop JOB1 from taking off as long as JOB2 is in abend status in the queue?

 JOB JOB1    
    RUN ANYDAY    
    NOTWITH JOB2    
  ENDJOB
    
  JOB JOB2 
    RUN ANYDAY    
    NOTWITH JOB1    
  ENDJOB

Resolution

No, the HOLD operand is needed with the NOTWITH statement as follows:

 JOB JOB1 
    RUN ANYDAY    
    NOTWITH JOB2    
    ENDJOB
    
 JOB JOB2 
    RUN ANYDAY    
    NOTWITH JOB1 HOLD    
    ENDJOB

The HOLD operand causes job JOB2 to hold onto any resources it was using. This keeps job JOB1 from running until job JOB2 is forced complete, restarted successfully or rerun successfully.