View previous topic :: View next topic
|
Author |
Message |
pingte
Active User
Joined: 03 Dec 2005 Posts: 120 Location: india
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
If it is empty, then there is nothing there to read.
Is there |
|
Back to top |
|
|
pingte
Active User
Joined: 03 Dec 2005 Posts: 120 Location: india
|
|
|
|
But how will we open the empty file in the cobol program? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
Back to top |
|
|
pingte
Active User
Joined: 03 Dec 2005 Posts: 120 Location: india
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Pinge,
Have you tried it?
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 |
|
|
pingte
Active User
Joined: 03 Dec 2005 Posts: 120 Location: india
|
|
|
|
Yes tried it
Where do u write AMP='amorg'? |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
IN JCL. |
|
Back to top |
|
|
rz061m
New User
Joined: 03 Mar 2006 Posts: 48 Location: Chennai
|
|
|
|
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 |
|
|
Pete Eagleton
New User
Joined: 14 Feb 2007 Posts: 11 Location: Chicago
|
|
|
|
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 |
|
|
|