How to set a return code



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

How to set a return code

Postby samurai007 » Wed Feb 03, 2010 11:41 am

Hi,

I have a PS file of LRECL=80, RECFM = FB.

Sample Data :
FIELD1 : RECEIVED
FIELD2 : RECEIVED
FIELD3 : NOT RECEIVED
FIELD4 : RECEIVED
FIELD5 : RECEIVED

The objective is to idenfity if any field is "Not Received".
Hence, my JCL would be something like..

//Step1
//Step2
....
...
//Step5 - Check if the file has the value as "Not received" for any field
//Step6 - Processing if "Not Received" is present in the file
//Step7 - Processing if "Not Received" is NOT present in the file

I had thought of setting a return code after Step5 based on which i could execute Step6/Step7.
However am unable to set the return code here.
Can someone help me on this ?

The Value "Received/Not Received" in the file begins at Position10.

Thanks,
Sam.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to set a return code

Postby expat » Wed Feb 03, 2010 3:50 pm

Return codes are set within the program
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: how to set a return code

Postby samurai007 » Wed Feb 03, 2010 4:29 pm

Return codes are set within the program


Yes.. i know that.

My question was whether we can set a user-defined return code ? like RC=10 etc.
If Yes, How ?

Thanks,
Sam.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to set a return code

Postby expat » Wed Feb 03, 2010 8:45 pm

Yes you can, and it is probably well explained in the documentation.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: how to set a return code

Postby Robert Sample » Wed Feb 03, 2010 11:26 pm

Which program or utility are you wanting to use to set the return code?
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: how to set a return code

Postby skolusu » Wed Feb 03, 2010 11:40 pm

Samurai,

Here is a sample DFSORT Job which will set a return code of 4 if the string 'NOT RECEIVED' is NOT found in the input file.

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                               
FIELD1 : RECEIVED                             
FIELD2 : RECEIVED                             
FIELD3 : NOT RECEIVED                         
FIELD4 : RECEIVED                             
FIELD5 : RECEIVED                             
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  OPTION COPY,NULLOUT=RC4                     
  INCLUDE COND=(10,12,CH,EQ,C'NOT RECEIVED')   
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: how to set a return code

Postby samurai007 » Fri Feb 05, 2010 12:14 pm

Hi,

First of all, thanks a lot for the sample code.
It worked perfectly.

But i would like a little more help here.

I would like to know if there is any way i can "Terminate" the jcl execution without abending it ?

for eg., I am planning to terminate the jcl at the end of step 5 here, if i get a return code of 4.
If return code is zero, i shall continue execution of the jcl.

I think using an IF condition might be difficult, because i have to replicate this same logic for nearly a dozen proc steps.. which means i need to have 12 nested-if conditions.

I have presently done this using the COND parameter in the Job statement, but, my quality team has rejected it saying it is not an accepted standard of coding.

Any other ideas, a simple proc or a job step which will terminate the job execution ?

TIA,
Sam.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to set a return code

Postby Robert Sample » Fri Feb 05, 2010 6:31 pm

It sounds like you need to ask the quality team what is the acceptable method of coding this.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: how to set a return code

Postby dick scherrer » Sat Feb 06, 2010 1:21 am

Hello,

Did this "quality team" explain why/how this violates standards?

Possibly they would respond better if you placed the COND= on the individual steps?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: how to set a return code

Postby samurai007 » Mon Feb 08, 2010 3:57 pm

Hi Dick,

Did this "quality team" explain why/how this violates standards?


I just now got the reply as "It is an unstructured form of coding; and hence needs to be avoided".

Please let me know what is the method to terminate an executing JCL without abending it ?

Thanks,
Sam
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post