Assume we have a KSDS with the following data :
AAAAA 11111
BBBBB 11111
CCCCC 11111
DDDDD 22222
EEEEE 22222
FFFFF 33333
GGGGG 33333
HHHHH 33333
IIIII 33333
JJJJJ 44444
KKKKK 55555
The first 5 bytes form the Prime key, and the next 5 bytes the Alternate key. (The data was copied from File-AID, hence the SPACE between the two fields. You may ignore it).
If I view the PATH(or using a program to read and display the records in the path from top to bottom), here is what I see :
AAAAA 11111
BBBBB 11111
CCCCC 11111
DDDDD 22222
EEEEE 22222
FFFFF 33333
GGGGG 33333
HHHHH 33333
IIIII 33333
JJJJJ 44444
KKKKK 55555
Now, if I view the PATH backwards (In FILE-AID, using that option, or using a CICS program by moving high-values to the alternate key and reading and displaying the records backwards - READPREV - till BOF) then how will the records be displayed ?
I was expecting the same result as before. However, this is what I got in FILE-AID:
CCCCC 11111
BBBBB 11111
AAAAA 11111
EEEEE 22222
DDDDD 22222
IIIII 33333
HHHHH 33333
GGGGG 33333
FFFFF 33333
JJJJJ 44444
KKKKK 55555
(If I used a program I would have got the same data, but from bottom to top, i.e. the KKKKK record first, and the CCCCC record last)
Why this is happening ?
Explanation
This is how the Alternate Index looks :
11111 AAAAABBBBBCCCCC
22222 DDDDDEEEEE
33333 FFFFFGGGGGHHHHHIIIII
44444 JJJJJ
55555 KKKKK
(The first five bytes of the ALT Index are not shown here, to make it look simpler).
When the path is read in the Forward direction, the ALT Index is read from TOP to BOTTOM, and within a record, LEFT to RIGHT. Hence we get the data in the order - A, B, C, D, E, F, G, H, I, J, K.
However when the path is read Backwards, the ALT Index is read from BOTTOM to TOP, LEFT to RIGHT (and NOT RIGHT to LEFT, which we would expect it to). Hence we get the data in the order - K, J, F, G, H, I, D, E, A, B, and C.
For some strange(or maybe there is a specific) reason, VSAM seems to be unable to read and process an ALT Index record from RIGHT to LEFT.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.