What is KSDS-It is key sequenced data set and of the file organisation and being used extensively in CICS.
What you will learn here…
Key Sequenced data sets where and how you need to use. How to get maximum benefit from it. Why most banking projects still being used.
A key-sequenced data set has each of its records identified by a key.(The key of each record is a field in a predefined position within the record.)
Also read: How to give dummy VSAM dataset
Each key must be unique in the KSDS data set.
- When the data set is initially loaded with data, or when new records are added, the logical order of the records depends on the collating sequence of the key field. This also fixes the order in which you retrieve records when you browse through the data set.
“>>Tip-To find the physical location of a record in a KSDS, VSAM creates and maintains an index. This relates the key of each record to the record’s relative location in the data set. When you add or delete records, this index is updated accordingly.”
With releases of DFSMS/MVS 1.4 and later, a data set can be greater than 4 GB in size if it is defined as extended format and extended addressability in the storage class.
How CICS treats KSDS files…
CICS supports, in both RL and non-RLS mode, KSDS data sets that are defined with these extended attributes.(Ref -IBM)
The 5 awesome benefits…
- As KSDS files are defined with index, all the records can be read using key value dynamically
- You can define alternate key, and these need not be unique.
- You can access more than one record with alternate key
- You can define AIX also called alternative index. Records stored here in sequential order
- CICS supports extensively of both kind of files. I mean, RLS and non-RLS files
Syntax for KSDS in COBOL
For primary key…
RECORD KEY IS data-name
For Alternative key
ALTERNATE RECORD KEY IS data-name