Using Date as key in KSDS.

All sort of Mainframes Interview Questions.
Post Reply
pratik_bhandari
New Member
Posts: 3
Joined: Thu Oct 23, 2014 12:03 pm

Using Date as key in KSDS.

Post by pratik_bhandari »

Hi,

Interviewer asked me that can we use Date as key in KSDS? I did say that it can be used but I was confused with this question. Interviewer did not tell me if it was wrong or right and asked next question. I searched on google also but I did not find if using date has different meaning in key. Could someone tell me if there is a difference using date as key and some other variable as key?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Using Date as key in KSDS.

Post by Robert Sample »

There is nothing special about using a date as a key in a KSDS. However, you have to carefully consider the date format since it will impact how the data is stored. Using the date in DDMMYYYY or MMDDYYYY format, for example, means the data will NOT be arranged in a uniformly ascending format. Using the date in YYYYMMDD format means all new records will be added at the end of the KSDS (assuming the date is the beginning of the key); this can impact performance.
pratik_bhandari
New Member
Posts: 3
Joined: Thu Oct 23, 2014 12:03 pm

Re: Using Date as key in KSDS.

Post by pratik_bhandari »

Robert Sample wrote: Sun Oct 17, 2021 6:29 pm There is nothing special about using a date as a key in a KSDS. However, you have to carefully consider the date format since it will impact how the data is stored. Using the date in DDMMYYYY or MMDDYYYY format, for example, means the data will NOT be arranged in a uniformly ascending format. Using the date in YYYYMMDD format means all new records will be added at the end of the KSDS (assuming the date is the beginning of the key); this can impact performance.
Thanks Robert. Your point is correct that it will be in ascending order, assuming it is in ascending order. This will also limit the total number of keys as 365 for a year? Right? That's another performance limitation.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1896
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Using Date as key in KSDS.

Post by Robert Sample »

If the key is nothing but the date (which would be rarely if ever used), then there would be a limit of 365 (or 366) records per year. If the key is compound and includes the date and one -- or more -- other fields, then the limit no longer applies.
pratik_bhandari
New Member
Posts: 3
Joined: Thu Oct 23, 2014 12:03 pm

Re: Using Date as key in KSDS.

Post by pratik_bhandari »

Yes correct Robert, I also agree. Thanks for your answers this has helped.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”