Page 1 of 1

Set Return Code using DFSORT

Posted: Fri Apr 13, 2007 10:59 am
by raveendra_ibm
Hi All,

I need to set a return code if the input dataset contains only header and trailer record, ie., record count = 2.
I have referred the manuals to find COUNT with EQUAL option, but it sets a return code of 4 or 12.
But I need to set a return code other than the standard return codes like 4,8,12,18 etc.
My requirement is to set the return code as 1234, is this possible through DFSORT ?

Please help !!!

Thanks,
Raveendra.

Posted: Fri Apr 13, 2007 7:51 pm
by Veera
Raveendra,

Do you just want to set the RETURN-CODE if the record count = 2 ,

Assumption:
**********
you does not want to check if the 2 records are header and trailer.
Ok lets assume the file always contians header and trailer. So if
we have 2 records then it means only header and trailer.

And do you want to copy the records into outfile or do you just want to
set RETURN-CODE??

Thanks,
Veera.

Posted: Fri Apr 13, 2007 7:59 pm
by raveendra_ibm
Hi Veera,

Thanks for your time..
Do you just want to set the RETURN-CODE if the record count = 2
Yes !!! Your assumption is correct. If record count is 2, then they are header and trailer. I need to set a return-code of 1234.
And do you want to copy the records into outfile or do you just want to
set RETURN-CODE??

I have a SORT step which takes this as input and sorts it based on certain fields and writes into an output file.
I wanted this step to return a return-code of 1234.

Thanks,
Raveendra.

Posted: Fri Apr 13, 2007 8:20 pm
by Veera
Raveendra,

As u said in ur first post looks like RC Can be used to set RC=12,
RC=4 or RC=0. I am not sure if we can set user defined RC.

Well i will try to get back if there is any means to do it.

Code: Select all


STEP001  EXEC PGM=ICETOOL                         
**************************************************
TOOLMSG  DD  SYSOUT=*                             
DFSMSG   DD  SYSOUT=*                             
INPFILE  DD  DISP=SHR,                            
             DSN=ABCD.TEST.INPUTFILE
TOOLIN DD  *                                      
      COUNT FROM(INPFILE) EQUAL(2) RC4            

I AM JUST CURIOS AS WHY YOU WANT TO SET TO SOME USER DEFINED
VALUE, BECAUSE USING COND PARAMETERS WE CAN CONTROL THE
FLOW OF JOB, and setting userdefined can be done using a cobol regsiter
RETURN-CODE i guess if we code a PGM.

Well lets see if there is a way to handle this using any utility.

Thanks,
Veera

Posted: Fri Apr 13, 2007 9:08 pm
by Frank Yaeger
My requirement is to set the return code as 1234, is this possible through DFSORT ?
No. DFSORT cannot set RC=1234.

Posted: Fri Apr 13, 2007 9:20 pm
by raveendra_ibm
Thanks for your response Frank !!!

Could you suggest me any other way of achieving the same... :(

Regards,
Raveendra.

Posted: Fri Apr 13, 2007 9:26 pm
by Frank Yaeger
Well, you could write an Assembler program to call ICETOOL, have ICETOOL pass back RC=12 or RC=0 for COUNT, and then have the Assembler program pass back RC=1234 instead of RC=12. Or you could just use a program (e.g. COBOL) to check for two records and pass back RC=1234.

Posted: Fri Apr 13, 2007 10:48 pm
by Veera
Raveendra,

Here is what i have done to acheive what you said,

STEP1 -> ICETOOL

COUNT FROM(INPFILE) EQUAL(2) RC4

STEP2 -> DUMMY COBOL PGM WHICH WILL EXECUTE ONLY
IF RC = 4.

NOTE : I HAVE SET 4 , YOU CAN SET 4/ 12/16 AND YOU NEED TO
BE CAREFUL AND ENSURE THAT YOU WILL NOT
GET THOSE RETURN CODES IN ANYOTHER EXCEPTION
CONIDTIONS. BEACUSE WE WANT THE NEXT STEP TO
BE EXECUTED ONLY UNDER THIS CONDITION.

I know this is not the best way but i dint find any other means too :)

Code: Select all


******************************************************************** 
STEP001  EXEC PGM=ICETOOL                                            
******************************************************************** 
TOOLMSG  DD  SYSOUT=*                                                
DFSMSG   DD  SYSOUT=*                                                
INPFILE  DD  DISP=SHR,                                               
             DSN=WYOM.VEERA.C4070SD.MONTHEND.T13                     
TOOLIN DD  *                                                         
      COUNT FROM(INPFILE) EQUAL(2) RC4                               
                                                                     
*                                                                    
   IF RC = 4 THEN                                                    
STEP002  EXEC  PGM=DUMMYCOB                                          
*                                                                    
SYSUDUMP DD    SYSOUT=*                                              
SYSPRINT DD    SYSOUT=*                                              
SYSOUT   DD    SYSOUT=*                                              
   ENDIF                                                             

DUMMY COBOL PGM

Code: Select all


000100******************************************************************
000010 IDENTIFICATION DIVISION.                                                 
000300******************************************************************
000400 PROGRAM-ID.                       DUMMYCOB.                      
000500 AUTHOR.                           TEST-VEERA.                   
000700 DATE-WRITTEN.                     APRIL 13,2007.                
000800 DATE-COMPILED.                                                  
000070******************************************************************        
000490 ENVIRONMENT DIVISION.                                                    
007200******************************************************************
007300*                                                                 
000500 CONFIGURATION SECTION.                                                   
007500*                                                                 
007600 SOURCE-COMPUTER.    IBM-370 WITH DEBUGGING MODE.                 
007700 OBJECT-COMPUTER.    IBM-370.                                     
007800*                                                                 
000530 INPUT-OUTPUT SECTION.                                                    
061600***************************************************************** 
061700 PROCEDURE DIVISION.                                              
061800******************************************************************
061800            MOVE '1234' TO RETURN-CODE.                                   
062000            STOP RUN.                                                     
062000******************************************************************
079300******************************************************************


Thanks,
Veera.

Posted: Sat Apr 14, 2007 8:20 pm
by raveendra_ibm
NOTE : I HAVE SET 4 , YOU CAN SET 4/ 12/16 AND YOU NEED TO BE CAREFUL
AND ENSURE THAT YOU WILL NOT GET THOSE RETURN CODES IN ANYOTHER EXCEPTION
CONIDTIONS. BEACUSE WE WANT THE NEXT STEP TO BE EXECUTED ONLY UNDER THIS CONDITION.
Only to ensure that the return code is not due to an exception, i was
trying to set a return code of 1234. Anyways, I think a cobol program to
read the records and set the return code is the only option :-(

Thank you Frank and Veera...

Regards,
Raveendra.

Posted: Sun Apr 15, 2007 12:47 am
by Veera
Raveendra,

Just a taught ....

If u r sure that file will never be empty , i.e file will atleast contain the hearder and trailer even if it doesnt contain any records then u can set the rc to empty file condition and then run the cobol dummy step..Well even if u code a complete cobol pgm and if the file contains records apart from the header and trailer then what r u planning to do ..have one more sort step to do the process or u can
handle the process in COBOL.


If we go with assumption that file will never be EMPTY , you can use the
above approach for sure.

Frank can give his taught on this ....

Frank in SORT when the file is empty rc will be 4 i guess ..is there a possibility that the rc could be 4 under any other conditions....please let us know.

Thanks,
Veera.

Posted: Sun Apr 15, 2007 8:08 pm
by Frank Yaeger
Frank in SORT when the file is empty rc will be 4 i guess ..is there a possibility that the rc could be 4 under any other conditions....please let us know
DFSORT normally passes back RC=0 for an emtpy file unless you specify NULLOUT=RC4. ICETOOL can pass back RC=4 for an empty file if you use COUNT with RC4.

Yes, DFSORT and ICETOOL can pass back RC=4 for other conditions. For more details, see:

http://publibz.boulder.ibm.com/cgi-bin/ ... 0721170811

and

http://publibz.boulder.ibm.com/cgi-bin/ ... 0721170811

Posted: Sun Apr 15, 2007 11:18 pm
by Veera
Thanks Frank ,

Ok so with ICETOOL it can be handled with EMPTY file thru COUNT and by setting the RC appropriately we can achieve the solution of setting RC = 1234 or any userdefined value with combination of ICETOOL and a DUMMY COBOL PGM.

Rest is upto Raveendra how he goes about it.

Thanks,
Veera.

Topic deleted by Admin

Posted: Mon Jan 25, 2016 11:04 pm
by academyindia4
<< Content deleted By Admin >>