View previous topic :: View next topic
|
Author |
Message |
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi All,
I have a problem for which I require your help.
I am using IF statement in the JCL. The situation that arises is described under:
"STEP03 or STEP04 or both the steps can return a high code (100 or 50 are the return codes that can be returned by both the steps). Based on the return codes, one of the two files that are created in the program is to be deleted. "
How can I code this situation? Can anyone please help me out? |
|
Back to top |
|
|
Agni
New User
Joined: 22 Nov 2007 Posts: 83 Location: Chennai
|
|
|
|
Hi Swapnadeep,
Please follow the below steps:
1) Have a separate DD for IF condition. That should be after the step03 and Step04.
//JOBCHKB2 IF STEP03.RC = 50 THEN
2) IF the condition is satisfied then you can have separate job step to delete the file (u can use IEFBR14 utility to do the same)
//JOBCHKB2 ELSE
3) If the condition is not satisfied, then do what ever you want in the ELSE part.
//JOBCHKB2 ENDIF
4) Then last step would be ENDIF.
I have given the above example for simple IF-THEN-ELSE. Try giving OR condition and please let me know the result.
Thanks
Agni. |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi Agni,
Thanks for your response. Actually I would delete the step only if the RC from STEP03/STEP04 is not equal to zero. Thus basically its a nested condition. Actually STEP04 is executed even if the RC from Step03 is not equal to zero. |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
what is ur condition??
1) delete some file if RC os STEP3 and STEP4 not = 0
or
2) delete the file if RC of STEP3 or STEP4 not = 0 |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
My condition is:
Delete some file if RC of STEP3 or STEP4 not = 0 |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi All,
I was able to solve the problem. But I think its a crude manner in which I was able to provide the logic. For the reference of all I am pasting the code underneath.
Code: |
// IF RC > 0 THEN
// IF RC = 100 THEN
//DEL01 EXEC PGM=IEFBR14
//PROGERR DD DSN=&NAME..PROGRAM.ERROR,
// DISP=(MOD,DELETE,DELETE),SPACE=(TRK,(1,1))
// ENDIF
// IF RC = 50 THEN
//DEL02 EXEC PGM=IEFBR14
//SERVERR DD DSN=&NAME..SERVICE.ERROR,
// DISP=(MOD,DELETE,DELETE),SPACE=(TRK,(1,1))
// ENDIF
//*
//STEP05 EXEC PGM=ABORT2
//UCC11NR DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//CEEDUMP DD SYSOUT=*
//SYSUDUMP DD SYSOUT=C
// ENDIF
|
|
|
Back to top |
|
|
|