How to handle VSAM status code in JCL itself?

Virtual Storage Access method - ESDS, KSDS, RRDS & LDS. Basic direct access method, Basic sequential -, Queued sequential -, Basic partitioned -, Indexed sequential -, Object - access method.
Post Reply
Ramesh_Mainframe
Registered Member
Posts: 21
Joined: Thu Jul 11, 2013 6:28 pm
India

How to handle VSAM status code in JCL itself?

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
Ramesh_Mainframe
Registered Member
Posts: 21
Joined: Thu Jul 11, 2013 6:28 pm
India

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

Post by Ramesh_Mainframe »

That is a good idea. But apart from that can JCL never know about such a case?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “SMS & VSAM and BDAM, BSAM, QSAM, BPAM, ISAM, OAM.”