Page 1 of 1

How to handle VSAM status code in JCL itself?

Posted: Wed Mar 23, 2016 7:51 am
by Ramesh_Mainframe
Hi,

In one of the COBOL programs, it reads a VSAM dataset. When the file is empty program ends with a VSAM status code. The file is opened in INPUT or I-O mode. I see STAYS code handling in COBOL program but I do not want to handle it in program rather in a JCL. Can I do that? Can you please suggest any way using that VSAM file can be checked if it is empty or not?

Re: How to handle VSAM status code in JCL itself?

Posted: Wed Mar 23, 2016 9:44 am
by Robert Sample
The easiest and simplest way is to change the IDCAMS that deletes / defines the VSAM data set to include a REPRO of a dummy record.  Then the COBOL program won't have to deal with an empty VSAM data set and the first thing the program can do is delete the dummy record.

Re: How to handle VSAM status code in JCL itself?

Posted: Fri Mar 25, 2016 1:33 pm
by Ramesh_Mainframe
That is a good idea. But apart from that can JCL never know about such a case?

Re: How to handle VSAM status code in JCL itself?

Posted: Fri Mar 25, 2016 4:30 pm
by Robert Sample
JCL doesn't "know" anything.  It is written to allocate resources and run programs, period.
And the issue arises due to the way VSAM works.  Short of redesigning VSAM (which is not likely), the problem of opening an empty VSAM data set for input does NOT depend upon the tool used; it is ALWAYS an issue.