stop job at an abend step
Posted:
Wed Feb 29, 2012 11:35 pm
by dn2012
Hello,
I am using following condition codes in each job COND=(0,NE,IMF1).
My goal is to stop job at an abend step.
LISTCAT EXEC PGM=IDCAMS,COND=(0,NE,IMF1)
SORT EXEC PGM=SORT,COND=(0,NE,LISTCAT)
STEP01 EXEC PGM=IDCAMS,COND=(0,NE,SORT)
But I am getting following message for any wrong change
COND Codes where not working in your Job.
000C,00000000,NONZERO,D120229,T0856,IDCAMS
#(001) PGM(IDCAMS ) ELAPSED(00:00:00) COMP(00012)
0000,00000000,FLUSHED,D120229,T0856,IDCAMS
#(002) PGM(IDCAMS ) NOT EXECUTED
#(003) PGM(SORT ) ELAPSED(00:00:01) COMP(00000)
000C,00000000,NONZERO,D120229,T0856,IDCAMS
#(004) PGM(IDCAMS ) ELAPSED(00:00:01) COMP(00012)
0000,00000000,FLUSHED,D120229,T0856,ITDWTOR
#(005) PGM(ITDWTOR ) NOT EXECUTED
) ELAPSED(00:00:02) TURNAROUND(00:00:02)
Any help will be appreciated.
thx
Re: stop job at an abend step
Posted:
Wed Feb 29, 2012 11:47 pm
by NicC
An abend is an ABnormal END - it is a termination of the job full stop. You do not need to get it to stop there it will do it itself. A completion code of 12 is NOT an abend - it is a normal end with a return code of 12 which probably means that something did not work but not seriously enough to disintegrate the planet or the job.
Posting snippets from the jes log/messages does not help determine what you need. If you want to stop after a return code of non-zero then conditionally execute a step after each program that executes either a non-existent program (which will stop the job) or whatever program your site uses to abend gracefully - usually with a message. If there is not one then write your own make sure it can take a message that it can display. You can also make it take a value through a parm that it will use as the return code but without abending. This latter is useful for testing JCL condition parameters - just replace the real program name with your little program.
Re: stop job at an abend step
Posted:
Thu Mar 01, 2012 1:39 am
by dn2012
I want to stop after a return code of non-zero
thanks
Re: stop job at an abend step
Posted:
Thu Mar 01, 2012 12:18 pm
by NicC
Well, implement one of the suggestions. Another suggestion would be to run each step in a seperate job.
Re: stop job at an abend step
Posted:
Fri Mar 02, 2012 3:52 am
by dn2012
I removed step name from conditions and its work fine now
Before:
COND=(0,NE,IMF1)
Now:
COND=(0,NE)
Re: stop job at an abend step
Posted:
Fri Mar 02, 2012 8:30 am
by steve-myers
Just in case your shop does not have a handy dandy ABEND program, here's a freebie.
* // EXEC PGM=ABENDMSG,PARM='MESSAGE TEXT'
* ABNORMALLY END AFTER WRITING
* ABM001E JOB ENDED BY ABENDMSG
* IF NO PARM TEXT PRESENT, OR
* ABM002E JOB ENDED - MESSAGE TEXT
ABENDMSG RSECT
WA DSECT
WASAVE DS 9D
WAWTOPRM DS XL124,0D
WALEN EQU *-WA
ABENDMSG RSECT
ABENDMSG AMODE 31
ABENDMSG RMODE ANY
USING WA,13
USING *,12
SAVE (14,12),,*
LR 12,15
L 8,0(,1)
LA 0,WALEN
GETMAIN RU,LV=(0)
ST 13,4(,1)
ST 1,8(,13)
LR 13,1
SR 9,9
ICM 9,B'0011',0(8)
JZ NOPARM
MVC WAWTOPRM(MWTOLEN),MWTO2
LA 14,WAWTOPRM+MTXT
LR 15,9
LA 8,2(,8)
MVCL 14,8
STH 14,0(,1)
LH 15,MWTO2
LA 15,MWTO2(15)
MVC 0(4,14),0(15)
LA 1,WAWTOPRM
SR 14,1
STH 14,0(,1)
B DOWTO
NOPARM LA 1,MWTO1
DOWTO WTO MF=(E,(1))
ABEND 99
DC 0F'0'
MWTO1 WTO 'ABM001E JOB ENDED BY ABENDMSG',
MF=L,ROUTCDE=11,DESC=7
DC 0F'0'
MWTO2 WTO 'ABM002E JOB ENDED - ',
MF=L,ROUTCDE=11,DESC=7
MWTOLEN EQU *-MWTO2
ORG MWTO2+4
DS C'ABM002E JOB ENDED - '
MTXT EQU *-MWTO2
ORG ,
DC 0D'0'
LTORG ,
DC 0D'0'
END ABENDMSG
The last 2 WTO macros need a continuation flag, which I removed so the code block would look OK.