MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Empty Vsam Doubt

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Mon Jun 07, 2004 8:34 pm    Post subject: Empty Vsam Doubt Reply with quote

Hi ,
A small doubt about using VSAM file in cobol program.I create a vsam file in step01 and in step02 I want to use it (for both input and output) in the cobol program -- I need to write some records in the cobol and access the records also in the same program.what should I use in the OPEN vsam --> I/O mode ? Do I need to initialise the file before opening it in I/O ? If so,how to initialise it?It's a KSDS File.After step02 I would be deleting this vsam.This is a temporary vsam file I'm using in the program.Any help would be greatly appreciated.

Thanks,
Vijay
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Jun 08, 2004 5:25 am    Post subject: Reply with quote

Vijay,

A newly created vsam file will have a zero value in HURBA(HI-USEDRBA) .In order to open the file for input or update processing , it requires that at least one data record be initially loaded into the file. This is because VSAM issues a VERIFY command upon opening a file to reset the end-of-file pointer. If the file has never been loaded, the VERIFY fails because the high used RBA (Relative Byte Address) (HI-USEDRBA) is still zero. Therefore, VSAM files must be initially "loaded" to set the HI-USED-RBA to a value other than zero. This is done by writing a record to the VSAM file in "load" mode and optionally deleting the record to empty the file while leaving the HI-USED-RBA at a non-zero value.

Check this link for opening empty vsam files.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.10.3.2.1?SHELF=&DT=20020923143836&CASE=

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
moyeenkhan
Beginner


Joined: 04 Dec 2002
Posts: 64
Topics: 21

PostPosted: Tue Jun 08, 2004 1:04 pm    Post subject: Reply with quote

OPEN OUTPUT if it is empty and OPEN I-O if it is populated
Back to top
View user's profile Send private message Send e-mail
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Tue Jun 08, 2004 6:11 pm    Post subject: Reply with quote

I initialised the vsam file in the cobol program itself.

1.open output (vsam)
2.add a dummy record
3.close vsam
4.now I use open i-o and use it for read or write.seems to be working fine.


Thanks,
Vijay
Back to top
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Mon Jun 14, 2004 2:20 pm    Post subject: Reply with quote

Does anybody know for a fact that one could OPEN for OUTPUT/CLOSE a VSAM file and initialize the file without writing a rec. That is, will a subsequent OPEN for IP and READ result in a valid EOF condition.

I know this can be done for PS files.

Thanx, Jack.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group