View previous topic :: View next topic
|
Author |
Message |
deepak14450
New User
Joined: 21 Dec 2017 Posts: 2 Location: India
|
|
|
|
Hi All,
I had a query of when do we use KSDS and index file in COBOL/CICS programs.Both of them look identical in terms of functionality to me. Are there any differences present in KSDS and index file and in which scenario what is to be used.
Please guide.
Thanks,
Deepak Kanar |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
- Get it through your head. There are NO "files" in MVS. NONE. MVS has "data sets." A data set may exist as a "file" on magnetic tape. And that is the sole proper use of "file" in MVS and z/OS.
- A VSAM KSDS (Keyed Sequential Data Set) exists as two paired data sets: the main data set and an index data set. The sole purpose of the index data set is to provide a fast lookup of the data in the data set. Other than the keys and lookup information, there is no data in the index data set.
|
|
Back to top |
|
|
deepak14450
New User
Joined: 21 Dec 2017 Posts: 2 Location: India
|
|
|
|
But when we create an indexed file using a COBOL program, we define RECORD key is data-name-1. And the same thing is done using KSDS too. We declare our unique key using IDCAMS. If both of them use the same functionality, then why was VSAM datasets introduced. Why cant we just deal with files is my question or what is the use of files if VSAM can do all the things |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Please take note of what is written - they are 'data sets' not 'files' so use the correct terminology. If they were 'files' it would be a KSF not a KSDS and FN= instead of DSN=. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
The ONLY indexed data sets you have been able to create on an IBM mainframe have been VSAM KSDS for many years. IBM used to support another indexed format, but that is long gone.
You use VSAM because IBM says if you want indexed records, you MUST use VSAM -- period. VSAM has some advantages over some of the earlier access methods.
Quote: |
Why cant we just deal with files is my question |
This question makes absolutely no sense because (1) the only files that exist on z/OS are in Unix System Services or on tape -- on disk they are called data sets and ONLY called data sets, and (2) you can use sequential data sets (or VSAM ESDS data sets), VSAM RRDS, or VSAM KSDS (VSAM linear data sets are rarely used by applications) -- you use VSAM because that is how you access them. COBOL does not have the tools available to handle the complexities of disk architecture directly; you must use some access method to read or write the data in COBOL.
I think it is about time to lock this topic -- you are asking questions which don't make sense nor do you use proper terminology. Perhaps you should move to Beginners and students forum as this forum is for professionals and you are asking rank beginner questions. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I think you guys are overly harsh on the terminology in this regard.
I agree that DATASET is the correct term regarding the physical location of the data.
The term File however is also used often in MVS.
Look at the TSO ALLOCATE command. One of the parameters is FILE. This is equivalent to the DD name in the JCL.
In a COBOL program there is a FILE-SECTION and a FD (File Definition).
There is also the concept of a File Layout, which describes the individual elements of the data within a dataset.
My point is that while there is a difference between Dataset and File, from the conceptual standpoint they a very similar. They describe a collection of data.
Many of my associates, and myself use these terms interchangeably in conversation. We do not let the minor differences become a diversion from what we are talking about.
Just my own view. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Data Set Ready, an RS-232 signal used by a modem to indicate to the computer that it is ready to receive data
so "data set" might be an alternative name for a modem |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
From the program's point of view the data stream comes to the program (or leaves) via a file. The data is stored in a data set. The data set is connected to the file/data stream via the DD statement. The ddname matches to the file name in the program. So, from my point of view:
Code: |
filename in program --> ddname on dd statement --> dataset pointed to by DSN(AME)=data set name |
But this only relates to data held on, or written to, a data set. Data from a modem, till, card reader, whatever may be a different data stream.
I am not trying to be pedantically correct here - it is simply how I view it as an application programmer (deceased). The world ain't going to stop just because we use the wrong terminology - but it goes along better if we do. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Here is a couple of snippets of a Cobol program. Notice the number of occurrences of the word FILE. This is Cobol terms and names used by the programmer.
This program uses KSDS (datasets), but that word is never referenced.
So now you have this new poster using the term FILE, which is all you see in the Cobol. He gets pounded here saying THERE NO FILES ON MVS, NONE!
The above statement is not true. Files and Datasets are talking about the same thing, but from a different perspective.
Since you don't know the perspective of the poster (in this case you do because he mentioned Cobol in his post), please consider Files and Datasets both acceptable when referring to DATA.
Code: |
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT NA04FL-FILE-I-O ASSIGN TO NA04FL
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS NA4-KEY-GRP
FILE STATUS IS FILE-STATUS.
DATA DIVISION.
FILE SECTION.
FD NA04FL-FILE-I-O
RECORD CONTAINS 4093 CHARACTERS
DATA RECORD IS NA4-REC-GRP.
COPY NA04FL. |
|
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Now that we all agree about the terminology...
If I add the word "alternate" right before the word "index", the question could almost make sense,
but some of Deepak phrases are still a mystery:
Quote: |
...
when can we use Index file (Non -VSAM) and when to use KSDS
...
when we create an indexed file using a COBOL program
... |
What is a "non-VSAM index file created by a COBOL program" ? Could this be a sequential file ? |
|
Back to top |
|
|
|