Query Reg CI and CA splits.

Help for IBM's record-oriented filesystem VSAM, ESDS, KSDS, RRDS, LDS and Storage management Subsystems

Query Reg CI and CA splits.

Postby shabukumar » Wed May 04, 2011 2:10 pm

Hi Friends,

I know how split works and the record will be placed on the ascending order of the primary key.

My query was as follows.

Suppose my ksds contains 10 records with the primary key value ranging from 01 to 10 in First CI. The CI can hold only 10 records. when I am trying to insert a new record 11, split occurs, and records from 06 to 10 will be in next available CI and 11 will be placed after 10.

Now I have space in First CI. As my records from 01 to 05 in CI 1 and 06 to 11 in CI 2, there was space for 5 records in CI 1. Will this space be unused or VSAM will manage the space accordingly so that when keep on inserting records, CI 1 will have 10 records and CI 2 will have next 10 and so on...

If you are not clear with my question, Kindly let me know.

If you are clear, Kindly let me clarify.

Awaiting your clarifications.
Warm Regards
Mainframe Trainer
What you learnt new in mainframe
Posts: 27
Joined: Thu Dec 18, 2008 4:15 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query Reg CI and CA splits.


Re: Query Reg CI and CA splits.

Postby Robert Sample » Wed May 04, 2011 2:56 pm

Your understanding of CI splits is incorrect. Once the split is done, you have records 1 through 5 in CI 1 and records 6 through 10 in CI 2. The key for record 11 will determine whether it is placed in CI 1 or CI 2 -- if the key value is less than the key value for record 6, the new record will be placed in CI 1.

As records are inserted with keys less than that of record 6, the unused space in CI 1 will be used for the new records. A CI or CA split creates freespace that can be used for data records. The only way CI 1 would have the first 10 records, CI 2 the next 10, and so forth would be if you unloaded the VSAM file, deleted / defined it, and then reloaded it with FREESPACE(0 0).

You need to download and read this Redbook: http://www.redbooks.ibm.com/abstracts/sg246105.html?Open which is the VSAM Demystified Redbook. All of this and more is explained there.
Robert Sample
Global moderator
Posts: 3095
Joined: Sat Dec 19, 2009 8:32 pm
Location: Bellevue, Iowa
Has thanked: 1 time
Been thanked: 176 times

Re: Query Reg CI and CA splits.

Postby BillW » Tue Nov 15, 2011 5:22 am

There are as few more nuances to it. First off is that there a free space parm when you define the KSDS cluster. There could be reasons to specify none and there may be reasons to specify a lot. There are two free space values, free bytes in a CI and free CI's in a CA. The two values are determined by the type of processing you expect when you designed the system.

Secondly to the key and where it is inserted. VSAM uses forward key compression and rear compression. The forward compression is it removes that portion of the key that is a match between adjacent CI's. For example if the key is "SMITH" and the next key is "SMITHE" all that is kept is "E". Additionally there is rear key compression. What happens in that case is that (and my memory is a little weak re the details) VSAM keeps what it needs to keep the key unique, but it discards anything after that. Later in determining where to place the new record, when looking at the last key in the CI, VSAM will expand thew rear portion of the rear compressed key with x'FF's, then compare to the key being added. Lastly, remember that VSAM only keeps the last key value in a CI. The size of the CI's in the index potentially be made smaller given the key compression possibilities of the file. Why, to try to minimize the size of the index and just possibly the number of index levels.
Posts: 20
Joined: Thu Nov 10, 2011 8:21 am
Has thanked: 0 time
Been thanked: 3 times

Re: Query Reg CI and CA splits.

Postby BillyBoyo » Tue Nov 15, 2011 6:01 am

If your data was such that a key would never be encountered that was less than the key which caused the split (but greater than the previous CI) then yes, you would have space in the CI that was never used.

If you have 100,000 records on your KSDS which you load sequentially, with zero CI freespace and then you insert one record, and you never write to that KSDS ever again, then the space in the split and the new CI would not be used.

It happens. It probably happens less than you think because of the key-compression Bill W mentioned.

Are you researching something particular to resolve some question, or are you just curious? If the former, feel free to give us some detail, if the latter, good on you, and get your head stuck into the Redbook that Robert metioned.
Global moderator
Posts: 3732
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 254 times

Re: Query Reg CI and CA splits.

Postby NicC » Tue Nov 15, 2011 12:19 pm

Only 6 months old
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Global moderator
Posts: 2509
Joined: Sun Jul 04, 2010 12:13 am
Location: Down on the pig farm
Has thanked: 4 times
Been thanked: 86 times

Return to VSAM/SMS


  • Related topics
    Last post