Handle VSAM empty file



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

Handle VSAM empty file

Postby satishmf » Fri Jun 05, 2009 10:54 am

My Production job is such that, on one of the steps it has to
copy a VSAM dataset to flat file, and then process that flat
file in the subsequent steps. Sometimes the input VSAM may be
empty. When its empty, my job abends. How can I prevent the job
from abending when the VSAM is empty ?
satishmf
 
Posts: 10
Joined: Wed Jun 03, 2009 4:31 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Handle VSAM empty file

 

Re: Handle VSAM empty file

Postby expat » Fri Jun 05, 2009 11:59 am

Use SORT to copy perform the copy, using the option to issue a return code of 4 or 16 if the output has zero records, and execute the rest of the job conditionally from that point on.
//DFSORT   EXEC PGM=SORT,PARM='NULLOUT=RC4'
expat
 
Posts: 382
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Handle VSAM empty file

Postby Frank Yaeger » Fri Jun 05, 2009 8:46 pm

You can use DFSORT to copy a VSAM data set to a sequential file without terminating when the file is empty. Just ensure that the VSAMEMT option is in effect (this is DFSORT's shipped default). You can ensure the VSAMEMT option is in effect with:

//DFSPARM DD *
   OPTION VSAMEMT
/*


If you want a RC=4 or RC=16 when the file is empty, you can use the NULLOUT=RC4 or NULLOUT=RC16. If you want a RC=0 when the file is empty, you can use NULLOUT=RC0 (DFSORT's shipped default).
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
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post