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: 8630
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: 8630
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 Where to get sample for processing RM... vice_versa PL/I & Assembler 2 Tue Jan 16, 2018 2:03 pm
No new posts VSAM dataset not found abdulrafi JCL & VSAM 5 Fri Jan 12, 2018 11:19 am
No new posts COB2 file processing rizwanaccy COBOL Programming 8 Tue Jan 02, 2018 1:00 pm
No new posts KSDS and Index file in cobol deepak14450 COBOL Programming 9 Fri Dec 22, 2017 9:36 am
No new posts Preserve order in Input File pshongal DFSORT/ICETOOL 13 Thu Dec 21, 2017 4:20 pm

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