Author: daveporcelan
Posted: Thu Feb 16, 2017 9:27 pm (GMT 5.5)
I agree with everyone above, having a batch Job wait is a bad idea.
However it would be pretty easy to do this with a Rexx exec.
Assuming the dataset in question has been created empty.
This exec would work.
It should be an added step in your JCL.
Use the return code to determine if you should run the Submit step for Job3.
You may want to put the check dataset as DD CHKFILE in your JCL then the ALLOC and FREE can be removed.
Posted: Thu Feb 16, 2017 9:27 pm (GMT 5.5)
I agree with everyone above, having a batch Job wait is a bad idea.
However it would be pretty easy to do this with a Rexx exec.
Assuming the dataset in question has been created empty.
This exec would work.
It should be an added step in your JCL.
Use the return code to determine if you should run the Submit step for Job3.
You may want to put the check dataset as DD CHKFILE in your JCL then the ALLOC and FREE can be removed.
Code: |
/* REXX EXEC TO CHECK FOR DATA EXISTENCE */ /* MAXRC = 0 - DATA FOUND */ /* MAXRC = 4 - DATA NOT FOUND MAX-SECS REACHED */ /* THIS IS TO PREVENT AN INFINITE LOOP */ INREC. = '' TOTAL_SECS = 0 SLEEP_SECS = 3 MAX_SECS = 20 MAXRC = 0 CHECK_FILE = 'CHECK.DATASET' "ALLOC DD(CHECKFIL) DA('"CHECK_FILE"') SHR REUSE" "EXECIO 1 DISKR CHECKFIL(STEM INREC. OPEN FINIS)" "FREE DD(CHECKFIL)" SAY 'CHECKING' CHECK_FILE 'AFTER' TOTAL_SECS 'SECONDS' IF INREC.1 = '' THEN DO FOREVER SLEEP SLEEP_SECS TOTAL_SECS = TOTAL_SECS + SLEEP_SECS SAY 'CHECKING' CHECK_FILE 'AFTER' TOTAL_SECS 'SECONDS' "ALLOC DD(CHECKFIL) DA('"CHECK_FILE"') SHR REUSE" "EXECIO 1 DISKR CHECKFIL(STEM INREC. OPEN FINIS)" "FREE DD(CHECKFIL)" IF INREC.1 /= '' THEN DO MAXRC = 0 LEAVE END ELSE IF TOTAL_SECS > MAX_SECS THEN DO MAXRC = 4 LEAVE END SAY 'CHKDATA COMPLETED MAXRC =' MAXRC ZISPFRC = MAXRC "ISPEXEC VPUT (ZISPFRC) SHARED" EXIT (ZISPFRC) |