Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Handling empty VSAM file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
murali.andaluri

New User


Joined: 07 Jun 2013
Posts: 5
Location: USA

PostPosted: Fri Jun 07, 2013 1:39 am    Post subject: Handling empty VSAM file
Reply with quote

I have attended client interview, they asked me the following question, please clarify.

There is an empty VSAM file, so whenever I am trying to read this empty VSAM file my JCL step should be abended, so what should I do for this?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 07, 2013 1:51 am    Post subject:
Reply with quote

Hello and welcome to the forum,

Many (most) questions can be answered by previous topics.

Read here:
http://www.ibmmainframes.com/about38798.html

Our Search function can be your friend icon_wink.gif
Back to top
View user's profile Send private message
murali.andaluri

New User


Joined: 07 Jun 2013
Posts: 5
Location: USA

PostPosted: Fri Jun 07, 2013 2:03 am    Post subject: Reply to: Handling empty VSAM file
Reply with quote

Hi Dick,

I have tried searching in portal, but didn't get satisfied solution.

He was asking daily we are receiving data in that file, suppose if you receive empty file instead of with data how you will abend your JCL?

Actually interviewer was asking me think whether you can do with listcat, but I didn't understand how to do with Listcat.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Jun 07, 2013 2:37 am    Post subject:
Reply with quote

Possibly because you can't reliably cause an abend with LISTCAT.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 07, 2013 3:37 am    Post subject:
Reply with quote

Hello,

Did you read the posted link?

You can read the output of the LISTCAT programmatically and then issue an abend or a flush depending on the empty /not-empty condition discovered by the LISTCAT.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jun 07, 2013 4:40 am    Post subject: Reply to: Handling empty VSAM file
Reply with quote

In a standalone step, issue an IDCAMS PRINT INFILE(VSAMFILE) COUNT(1). If the file is empty, an RC=04 will be raised.

If the customer worries about exposing delicate file-information from PRINT, specify DD DUMMY for SYSPRINT.

Remember, you're only interested in the return-code. icon_wink.gif
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Fri Jun 07, 2013 12:11 pm    Post subject:
Reply with quote

9 ways to check empty file
- Credits to Stefan
https://docs.google.com/document/d/1MwkNFN0eH6mmhjAArAFTPg0uOUFcZPu2RvzPV1T2Amw/edit
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Jun 07, 2013 12:31 pm    Post subject: Reply to: Handling empty VSAM file
Reply with quote

Note that "some" of the nine won't apply for VSAM without changes...
Back to top
View user's profile Send private message
murali.andaluri

New User


Joined: 07 Jun 2013
Posts: 5
Location: USA

PostPosted: Wed Jun 12, 2013 11:15 pm    Post subject: Reply to: Handling empty VSAM file
Reply with quote

Hi,

I have tried Vasanth first way, but I got RC=16
and
IDC3351I ** VSAM OPEN RETURN CODE IS 160

IDC0005I NUMBER OF RECORDS PROCESSED WAS 0

IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12

My dataset is empty so it should set RC=0004, but it is showing RC=16.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Wed Jun 12, 2013 11:36 pm    Post subject:
Reply with quote

Murali, I am not sure if there is a language barrier or what here.

VSAM distinguishes between an empty file (that is, a VSAM file that has been opened for output before, whether or not there is now a record in it), and an unused file (that is, a VSAM file that has never been opened for output -- ever).

The difference is that an unused file CANNOT be opened for input under any circumstances, while an empty VSAM file can be opened for input. If you have just defined a VSAM file in yoiur JCL, and you attempt to open that VSAM file for input before doing anything else -- that attempt will fail, always and forever. Depending upon which program or utility you are using, you might get a file status code or a 12 / 16 step return code, but in all cases the open will not succeed.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Jun 13, 2013 12:02 am    Post subject: Re: Reply to: Handling empty VSAM file
Reply with quote

Bill Woodger wrote:
Note that "some" of the nine won't apply for VSAM without changes...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us