Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to Read Empty VSAM file in a cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pingte

Active User


Joined: 03 Dec 2005
Posts: 120
Location: india

PostPosted: Wed May 09, 2007 5:38 pm    Post subject: How to Read Empty VSAM file in a cobol program
Reply with quote

hi,

How can i read a empty VSAM file in a COBOL program.
Is there any special entry to be made in the FD section?

TIA
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed May 09, 2007 5:43 pm    Post subject:
Reply with quote

If it is empty, then there is nothing there to read.

Is there icon_eek.gif
Back to top
View user's profile Send private message
pingte

Active User


Joined: 03 Dec 2005
Posts: 120
Location: india

PostPosted: Wed May 09, 2007 5:51 pm    Post subject:
Reply with quote

But how will we open the empty file in the cobol program?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed May 09, 2007 5:58 pm    Post subject:
Reply with quote

Will this help ???

http://ibmmainframes.com/viewtopic.php?t=16516
Back to top
View user's profile Send private message
pingte

Active User


Joined: 03 Dec 2005
Posts: 120
Location: india

PostPosted: Wed May 09, 2007 6:08 pm    Post subject:
Reply with quote

Expat,

That did not help.
I got the solution ...

it can be done thru OPTIONAL clause...

SELECT OPTIONAL LOGICAL-FILE-NAME ASSIGN TO PHYSICAL-FILE-NAME

This optional clause creates a dummy record in VSAM file through which it can be opened.

TIA
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Thu May 10, 2007 2:44 pm    Post subject:
Reply with quote

Pinge,
Have you tried it? icon_smile.gif
I had some confusion regarding OPTIONAL clause before.
I have tried to read DUMMY vsam file by giving AMP='amorg', and it works fine but never really tried OPTIONAL clause to read a VSAM.
Back to top
View user's profile Send private message
pingte

Active User


Joined: 03 Dec 2005
Posts: 120
Location: india

PostPosted: Thu May 10, 2007 2:50 pm    Post subject:
Reply with quote

Yes tried it icon_biggrin.gif
Where do u write AMP='amorg'?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Thu May 10, 2007 7:07 pm    Post subject:
Reply with quote

IN JCL.
Back to top
View user's profile Send private message
rz061m

New User


Joined: 03 Mar 2006
Posts: 48
Location: Chennai

PostPosted: Fri May 11, 2007 11:59 am    Post subject:
Reply with quote

Hi,

Open the file in OUTPUT mode and CLOSE the file immediately.

then open the file in INPUT mode, it will not abend this time, rather will set the VSAM status code to 10 - end-of file.

thanks,
Rz061m.
Back to top
View user's profile Send private message
Pete Eagleton

New User


Joined: 14 Feb 2007
Posts: 11
Location: Chicago

PostPosted: Tue May 15, 2007 3:38 am    Post subject:
Reply with quote

BEST IDEA. open the file for input and test your status code for a 35. if you get a 35 file is empty.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us