IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

VSAM general query


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
subratarec

Active User


Joined: 22 Dec 2007
Posts: 126
Location: Bangalore

PostPosted: Fri Apr 10, 2015 1:20 pm
Reply with quote

Hi,

I need to know a very basic info related to VSAM. As I haven't worked on VSAM much in past. So my understanding in VSAM is bit less. Question is...

I have created a VSAM cluster (KSDS) using IDCAMS, it created successfully. and I haven't loaded any data into the KSDS. Now can I insert valid data using application program (say PL/1 or COBOL) to that KSDS VSAM file?

IF not, can anyone through some light on why we can't (any reference to read is also ok)

Thanks in advance
Subrata
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Apr 10, 2015 4:22 pm
Reply with quote

As long as you open the VSAM file for output (and not I-O), you can use an application program to put data into it.
Back to top
View user's profile Send private message
subratarec

Active User


Joined: 22 Dec 2007
Posts: 126
Location: Bangalore

PostPosted: Sat Apr 11, 2015 8:39 am
Reply with quote

Hi Robert,

Thanks for the reply. Initially I also thought the same. But someone changed my way of understanding by saying that

"Post creation of KSDS cluster if it doesn't have any data in it, we can't use application program to insert data in the KSDS. As the Index of the KSDS wasn't build (because it was blank) application pgm can't insert the data. We have to load atleast some valid data in it, then the Index will be built. After that only we will be able to use App pgm to insert data in it."

I couldn't understand why would that happen. To my understanding app pgm will treat it is as just another output ds (which is having more capabilities than normal PS file) and can write valid data in it.

Anyway thanks for clearing my doubt.

Thanks
Subrata
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Apr 11, 2015 8:56 am
Reply with quote

Whoever made that statement to you is wrong. VSAM does make a distinction between an empty data set (which has never had any records in it) and a data set which has had records in it but does not now have any. An empty data set CANNOT be opened for input since some of the internal pointers don't get established until the first record is written to the data set.

For clarification, I quote the Enterprise COBOL Application Programming Guide manual:
Quote:
1.10.3.2.1 Opening an empty file


To open a file that has never contained records (an empty file), use a form of the OPEN statement. Depending on the type of file that you are opening, use one of the following statements:
OPEN OUTPUT for ESDS files.
OPEN OUTPUT or OPEN EXTEND for KSDS and RRDS files. (Either coding has the same effect.) If you coded the file for random or dynamic access and the file is optional, you can use OPEN I-O.



Optional files are files that are not necessarily present each time a program is run. You can define files opened in INPUT, I-O, or OUTPUT mode as optional by defining them with the SELECT OPTIONAL clause in the FILE-CONTROL paragraph.
Initially loading a file sequentially: Initially loading a file means writing records into the file for the first time. Doing so is not the same as writing records into a file from which all previous records have been deleted. To initially load a VSAM file:
Open the file.
Use sequential processing (ACCESS IS SEQUENTIAL). (Sequential processing is faster than random or dynamic processing.)
Use WRITE to add a record to the file.
Using OPEN OUTPUT to load a VSAM file significantly improves the performance of your program. Using OPEN I-O or OPEN EXTEND has a negative effect on the performance of your program. When you load VSAM indexed files sequentially, you optimize both loading performance and subsequent processing performance, because sequential processing maintains user-defined free space. Future insertions will be more efficient. With ACCESS IS SEQUENTIAL, you must write the records in ascending RECORD KEY order. When you load VSAM relative files sequentially, the records are placed in the file in the ascending order of relative record numbers.
So the COBOL manual specifically addresses the issue that you were told about.
Back to top
View user's profile Send private message
subratarec

Active User


Joined: 22 Dec 2007
Posts: 126
Location: Bangalore

PostPosted: Sat Apr 11, 2015 10:11 am
Reply with quote

Hi Robert,

Thanks for the detail clarification. Let me go through the COBOL Manual for this. I will let my guy know that his understanding is wrong. Data can be inserted/write through App Pgm to a newly created blank KSDS cluster.

Will come back if I have any doubts

Thanks
Subrata
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Sat Apr 11, 2015 11:32 am
Reply with quote

The word "inserted" may actually mean something different than I think you intended.

"Inserted" actually means one or more records were added to a data set that already contains records. It does not mean one or more records were added to a data set that has no records in it.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Apr 11, 2015 12:45 pm
Reply with quote

see here for all what You might want to know about VSAM
www.redbooks.ibm.com/abstracts/sg246105.html?Open
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts RC query -Time column CA Products 3
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
Search our Forums:

Back to Top