Page 1 of 1

AIX in KSDS VSAM.

Posted: Mon Aug 05, 2013 11:04 am
by Biden
Hi,

I've a doubt about AIX record size: when we create AIX we give record size as Primary index + length of AIX + 5 bytes? What is purpose of these five bytes and what the info it will stores in it?

Thanks,

Re: AIX in KSDS VSAM.

Posted: Mon Aug 05, 2013 3:16 pm
by Robert Sample
The 5 bytes are system information -- IBM does not tell us what is stored in those bytes; therefore it can be categorically stated that there is no reason for you to know that. If you work for IBM, and get assigned to work on VSAM, then you can find out (but you might have to sign a non-disclosure agreement before you find out).

And your formula for the AIX record size is incomplete -- you gave the record size for a UNIQUE alternate index. Alternate indexes, unlike primary keys, can have duplicate values (up to 32767 of them) and hence the alternate index record size can be VASTLY greater than the base cluster record size.

Re: AIX in KSDS VSAM.

Posted: Wed Aug 07, 2013 8:52 am
by Biden
Thanks Robert.

As you indicated about the formula, I look back and see that this might be correct: RECSZ= 5 + AIXKL + (n x BCKL). Where

AIXKL is the alternate-key length. (See the KEYS parameter.)
BCKL is the base cluster's prime-key length.
n=1 when the UNIQUEKEY parameter is specified.
n is equal to the number of base cluster records that have the same alternate index key when NONUNIQUEKEY is specified.

Is that correct, please suggest.

Re: AIX in KSDS VSAM.

Posted: Wed Aug 07, 2013 4:29 pm
by Robert Sample
Yes. If your alternate key length is 27 bytes and your primary key length is 20 bytes and you expect up to 10,000 duplicates then 5 + 27 + 10000*20 gives 200032 as the alternate index record size.

Re: AIX in KSDS VSAM.

Posted: Sun Aug 11, 2013 11:32 am
by Biden
Thanks Robert.

Re: AIX in KSDS VSAM.

Posted: Fri Aug 16, 2013 7:53 pm
by Robert Sample
Update: after doing some research, I managed to find out what the 5 bytes are:
Byte
1 - ESDS/KSDS indicator (X'00' for ESDS, X'01' for KSDS)
2 - X'04' for ESDS (length of RBA) and length of primary key for KSDS
3-4 - Binary count of key occurrences if NONUNIQUEKEY (X'0001' to X'FFFF'), X'0001' if UNIQUEKEY
5 - Length of alternate index key

Re: AIX in KSDS VSAM.

Posted: Fri Aug 23, 2013 3:11 pm
by Biden
Excellent, Thanks for your time Robert. This is a great help.