Page 1 of 1

Using Alternate Index in vsam

PostPosted: Mon Nov 05, 2012 6:47 pm
by gowthamgyaa
Hi everyone,
I need a help in AIX.
I have a KSDS record as below,
01    RAM    TNR    usa    10    IPDEV    10    20    200    100    100    20    05    15

I have to create an AIX key for the above, so do i need to count fillers ?
for ex: i Need to get region alone, so for that how should i define the key with spaces or without spaces?

Pls help me to solve this.


Kind regards
gyaa

Re: Using Alternate Index in vsam

PostPosted: Mon Nov 05, 2012 7:08 pm
by Robert Sample
I think you are SERIOULSY confused about VSAM alternate indexes. A VSAM alternate index (AIX) is defined as a set of sequential bytes in the record that can be used to read the file in other than the primary key sequence. An AIX may -- or may not -- allow duplicates; if duplicates are allowed there cannot be more than 32767 primary keys with the same alternate index key value. An AIX can be defined anywhere in the record and is accessed through its defined PATH. An AIX record size is not related to the base cluster record length and is defined as 4 + alternate index key length + (n times primary key length), where n is 1 if no duplicates are allowed and the maximum number of duplicate primary keys your application allows if duplicates are okay).

Whether or not you define the AIX key with spaces depends upon the record defintiion and how you are setting up the AIX. This is NOT a question we can answer -- it depends ENTIRELY upon your application and its access requirements, which we cannot tell you since we did not write the specifications for your application.

Re: Using Alternate Index in vsam

PostPosted: Mon Nov 05, 2012 9:27 pm
by dick scherrer
Hello,

By which field(s) do you want to directly access the record(s).

Depending on what really is the requirement, you may need more than one alternate index.

Re: Using Alternate Index in vsam

PostPosted: Mon Nov 05, 2012 10:41 pm
by gowthamgyaa
Hello,
Thanks for your reply.
I need to access only region field (USA) in above example.
For this i need to give a key but i am confused to count space or not.


Kind regards
gyaa

Re: Using Alternate Index in vsam

PostPosted: Mon Nov 05, 2012 10:57 pm
by dick scherrer
Hello,

Yup, you are confused . . .<g>

To define an alternate index for that field, you need only define the number of bytes the longest value can be (and the displacement to the first byte). Read about DEFINE ALTERNATEINDEX-

Sggest you find another alternate index definition that is workingon your system and clone it ( making sure you understand each line of the definition.

Re: Using Alternate Index in vsam

PostPosted: Tue Nov 06, 2012 12:11 am
by NicC
I know you are on an educational system so I guess you may not find another working alternate index but certainly do the reading.

Re: Using Alternate Index in vsam

PostPosted: Tue Nov 06, 2012 12:38 am
by Robert Sample
Whether or not you count the spaces will depend upon whether or not the spaces are part of the field you want to create the alternate index on. If you do not know the answer to this, you need to either reread the documentation you were given for the problem, or talk to your instructor.