View previous topic :: View next topic |
Author |
Message |
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Mon Jun 07, 2004 8:34 pm Post subject: Empty Vsam Doubt |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Jun 08, 2004 5:25 am Post subject: |
|
|
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 |
|
|
moyeenkhan Beginner
Joined: 04 Dec 2002 Posts: 64 Topics: 21
|
Posted: Tue Jun 08, 2004 1:04 pm Post subject: |
|
|
OPEN OUTPUT if it is empty and OPEN I-O if it is populated |
|
Back to top |
|
|
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Tue Jun 08, 2004 6:11 pm Post subject: |
|
|
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 |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Mon Jun 14, 2004 2:20 pm Post subject: |
|
|
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 |
|
|
|
|