IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Handling empty VSAM file


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

New User


Joined: 07 Jun 2013
Posts: 23
Location: USA

PostPosted: Fri Jun 07, 2013 1:39 am
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

Moderator Emeritus


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

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

Hello and welcome to the forum,

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

Read here:
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: 23
Location: USA

PostPosted: Fri Jun 07, 2013 2:03 am
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: 1788
Location: Bloomington, IL

PostPosted: Fri Jun 07, 2013 2:37 am
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

Moderator Emeritus


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

PostPosted: Fri Jun 07, 2013 3:37 am
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jun 07, 2013 4:40 am
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: 1742
Location: Tirupur, India

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

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jun 07, 2013 12:31 pm
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: 23
Location: USA

PostPosted: Wed Jun 12, 2013 11:15 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 12, 2013 11:36 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 13, 2013 12:02 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top