Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

VSAM general query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
subratarec

New User


Joined: 22 Dec 2007
Posts: 73
Location: Bangalore

PostPosted: Fri Apr 10, 2015 1:20 pm    Post subject: VSAM general query
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: 7904
Location: Bellevue, IA

PostPosted: Fri Apr 10, 2015 4:22 pm    Post subject:
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

New User


Joined: 22 Dec 2007
Posts: 73
Location: Bangalore

PostPosted: Sat Apr 11, 2015 8:39 am    Post subject: Reply to: VSAM general query
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: 7904
Location: Bellevue, IA

PostPosted: Sat Apr 11, 2015 8:56 am    Post subject:
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

New User


Joined: 22 Dec 2007
Posts: 73
Location: Bangalore

PostPosted: Sat Apr 11, 2015 10:11 am    Post subject: Reply to: VSAM general query
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 User


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

PostPosted: Sat Apr 11, 2015 11:32 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Sat Apr 11, 2015 12:45 pm    Post subject: Reply to: VSAM general query
Reply with quote

see here for all what You might want to know about VSAM
http://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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts BWO option in VSAM blayek CICS 3 Sat Nov 05, 2016 10:47 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us