If the VSAM is empty then copy job abends

 

If the VSAM is empty then copy job abends
 
 
There may be a situation where you have to copy a VSAM file
to a flat file and if the VSAM file for some reason is empty then 
the sort copy job abends with abend code of U0016.
 
Please refer the following JCL
 
//STEP001 EXEC PGM=SORT
//*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=VSAM.DSN,DISP=SHR
//SORTOUT DD DSN=FLATFILE.DSN,
//  DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=COPY
/*
 
 
You can bypass this abend by specifying the VSAMEMT=YES parameter with 
SORT 
 
Here is an example of the situation
 
 
//STEP001 EXEC PGM=SORT,PARM=’VSAMEMT=YES’
//*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=VSAM.DSN,DISP=SHR
//SORTOUT DD DSN=FLATFILE.DSN,
//  DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=COPY
/*

Comments

thanks for this..really helpful