Page 1 of 2

How to set a return code

PostPosted: Wed Feb 03, 2010 11:41 am
by samurai007
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.

Re: how to set a return code

PostPosted: Wed Feb 03, 2010 3:50 pm
by expat
Return codes are set within the program

Re: how to set a return code

PostPosted: Wed Feb 03, 2010 4:29 pm
by samurai007
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.

Re: how to set a return code

PostPosted: Wed Feb 03, 2010 8:45 pm
by expat
Yes you can, and it is probably well explained in the documentation.

Re: how to set a return code

PostPosted: Wed Feb 03, 2010 11:26 pm
by Robert Sample
Which program or utility are you wanting to use to set the return code?

Re: how to set a return code

PostPosted: Wed Feb 03, 2010 11:40 pm
by skolusu
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')   
//*

Re: how to set a return code

PostPosted: Fri Feb 05, 2010 12:14 pm
by samurai007
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.

Re: how to set a return code

PostPosted: Fri Feb 05, 2010 6:31 pm
by Robert Sample
It sounds like you need to ask the quality team what is the acceptable method of coding this.

Re: how to set a return code

PostPosted: Sat Feb 06, 2010 1:21 am
by dick scherrer
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?

Re: how to set a return code

PostPosted: Mon Feb 08, 2010 3:57 pm
by samurai007
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