Page 1 of 1

How to read a KSDS file using part of its key?

PostPosted: Mon Jun 18, 2012 12:08 pm
by ashwin1990
Hi All,

I want to read a KSDS file using part of its key.

eg: Suppose my KSDS file has a key of lenth 20, i want to read it using key, starting from position 10.

Is it possible to do so????

Re: How to read a KSDS file using part of its key?

PostPosted: Mon Jun 18, 2012 1:14 pm
by mongan
No, you will need to use an alternate index.

Re: How to read a KSDS file using part of its key?

PostPosted: Mon Jun 18, 2012 2:06 pm
by ashwin1990
but again alternate index has to start from position 1 ..... isnt it???

I want to read from position 10.

Re: How to read a KSDS file using part of its key?

PostPosted: Mon Jun 18, 2012 2:18 pm
by enrico-sorichetti
NO!
an alternate index key can start wherever You feel the need to.

but ... processing thru an alternate key might return the records in a different sequence than the primary key.

Re: How to read a KSDS file using part of its key?

PostPosted: Mon Jun 18, 2012 2:23 pm
by ashwin1990
ok....... thnks :)

Re: How to read a KSDS file using part of its key?

PostPosted: Mon Jun 18, 2012 5:22 pm
by mongan
Depending on how large your file is and what you want to do you might be better off extracting the records and sorting them. Don't forget that when you use an alternate key that you my have duplicate keys (same key for different records). Maybe you should share what you are exactly doing or want to do.

Re: How to read a KSDS file using part of its key?

PostPosted: Mon Jun 18, 2012 7:59 pm
by dick scherrer
Hello,

I suspect the "key" is made up of multiple fields and the requirement is to select records based on something that that is NOT the high-order part of the key.

To do this directly, an alternate key of just what IS needed could be defined.

This will imply extra overhead as well as extra space that would need to be weighed against how often this "query" would be executed and how much data is in the file.