Page 1 of 1

Error while copying VSAM file

PostPosted: Wed Mar 27, 2013 8:21 pm
by ashokkumar_rn
Hi,

The below step is being used in one of my jobs to copy a VSAM file to a PS file.

//STEP01 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT FILE(VSAM file),DISP=SHR
//SORTOUT DD DSN=OUTPUT FILE(PS dataset),DISP=OLD
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=SORTOUT,VTOF,OUTREC=(5,300)
/*

Sometimes this step fails with the below error message -

VSAM INPUT ERROR L(156) SORTIN

To resolve this all I have to do is restart the job from this step after some time.

Can someone help me understand why this happens and what can be done to fix this permanently?

Thanks in advance.

Re: Error while copying VSAM file

PostPosted: Wed Mar 27, 2013 8:31 pm
by steve-myers
If we can believe your initial post, the SORTIN DD statement is specifying a member of a PDS.

Re: Error while copying VSAM file

PostPosted: Wed Mar 27, 2013 8:33 pm
by Robert Sample
Is the VSAM file open in another address space (such as a CICS region) while you are doing your copy? If not, change the DISP=SHR to DISP=OLD to verify that nothing else can access the file while you are doing your copy.

Re: Error while copying VSAM file

PostPosted: Wed Mar 27, 2013 8:36 pm
by Akatsukami
You should have mentioned that the message number was ICE076A.

Re: Error while copying VSAM file

PostPosted: Wed Mar 27, 2013 8:45 pm
by ashokkumar_rn
@Robert - This VSAM file is not being used CICS. This is the only job that uses this file. I will try changing disposition to DISP=OLD and see if this resolves the problem. The problem is that this happens very rarely. Say, once in 2-3 months and all I do to resolve the problem is just restart the job from the failed step.

@Akatsukami - Yes. The message number was indeed ICE076A. I tried going thru the online forums to see if I can find why this was happening but I did not get much information.

@Steve - I have not specified the exact file name in SORTIN. The actual production step has a VSAM file there.

Re: Error while copying VSAM file

PostPosted: Wed Mar 27, 2013 8:52 pm
by Akatsukami
ashokkumar_rn wrote:@Akatsukami - Yes. The message number was indeed ICE076A. I tried going thru the online forums to see if I can find why this was happening but I did not get much information.

You would do better to go directly to the DFSORT Messages and Codes manual, and only to help fora if the meaning of the message or error code remains unclear.

Re: Error while copying VSAM file

PostPosted: Wed Mar 27, 2013 9:10 pm
by Robert Sample
For ICE076A, the L(156) is the feedback code. The manual has this to say about 156:
An invalid control interval was detected during keyed processing. The possible invalid conditions are:

A key is not greater than the previous key.
A key is not in the current control interval.
A spanned record RDF is encountered.
A freespace pointer is invalid.
The number of records does not match a group RDF record count.
If the file is not used by any other address space, then you may need to add an IDCAMS VERIFY step before your SORT step.

Re: Error while copying VSAM file

PostPosted: Thu Mar 28, 2013 3:17 pm
by ashokkumar_rn
Thanks Robert. Just out of curiosity, if this VSAM file was being used by another address space like(CICS) then how can I prevent such failure?

Re: Error while copying VSAM file

PostPosted: Thu Mar 28, 2013 4:36 pm
by Robert Sample
You cannot prevent all such failures -- if the problem is failing hardware, then the 156 feedback codes will continue (usually intermittently) until the disk drive fails completely.

However, the point about other address spaces (and CICS in particular) is that at least two of the five conditions listed in the manual message could occur if another address space is updating the VSAM file at the same time your program is reading it. If that were the case, there are two reasonably easy solutions and one difficult solution to choose from: (1) close the file in CICS (or whatever the other address space is) while your program is using the file, (2) use DISP=OLD for the VSAM file in your JCL so you have exclusive control when reading the data, or (3) (this is the hard one) implement enqueue / dequeue logic in both the other address space and your program to ensure the VSAM file retains integrity.

One thing that is relevant is the share options for the VSAM file since (1,3) is the only combination that causes VSAM to maintain integrity of the file. (2,3) places the responsibility upon your program to ensure read integrity (in other words, something could update the data while you are reading the file), while (3,3) and (4,3) basically require the third option I listed in the previous paragraph.