Set Return Code using DFSORT

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
raveendra_ibm
Member
Posts: 4
Joined: Tue Apr 03, 2007 10:42 pm

Set Return Code using DFSORT

Post by raveendra_ibm » Fri Apr 13, 2007 10:59 am

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.

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Fri Apr 13, 2007 7:51 pm

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.

raveendra_ibm
Member
Posts: 4
Joined: Tue Apr 03, 2007 10:42 pm

Post by raveendra_ibm » Fri Apr 13, 2007 7:59 pm

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.

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Fri Apr 13, 2007 8:20 pm

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

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Apr 13, 2007 9:08 pm

My requirement is to set the return code as 1234, is this possible through DFSORT ?
No. DFSORT cannot set RC=1234.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

raveendra_ibm
Member
Posts: 4
Joined: Tue Apr 03, 2007 10:42 pm

Post by raveendra_ibm » Fri Apr 13, 2007 9:20 pm

Thanks for your response Frank !!!

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

Regards,
Raveendra.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Apr 13, 2007 9:26 pm

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.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Fri Apr 13, 2007 10:48 pm

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.

raveendra_ibm
Member
Posts: 4
Joined: Tue Apr 03, 2007 10:42 pm

Post by raveendra_ibm » Sat Apr 14, 2007 8:20 pm

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.

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Sun Apr 15, 2007 12:47 am

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.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Sun Apr 15, 2007 8:08 pm

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
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Sun Apr 15, 2007 11:18 pm

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.

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 11:04 pm

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others