karunkallore Beginner
Joined: 11 Dec 2004 Posts: 103 Topics: 39
|
Posted: Mon Mar 13, 2006 7:17 pm Post subject: VSAM -Alternate Index . |
|
|
Hello Friends,
An advice into the scenario listed below would of great help !!
I have a VSAM file ( A KSDS ). It has an alternate index.
As an example for the VSAM file layout.
Code: |
Primary Key Secondary Key
----------------- ----------------------
1------------------------A
2------------------------B
3------------------------B
4------------------------A
|
Now i need to read this file from the Top to Bottom. This file has to be read sequentially at the first. After the first read one should be able to get the value in the secondary key position. That is in this case 'A'. Now with this A the application programs does some checking and if those checks are satisfied then it takes that 'A' and it should get all the occurances of 'A' in the file in the secondary key position. The it should table here the primary keys got corresponding to 'A' . In this case '1' and '4'. After reading the entire file through the alternate index for 'A' it should come again and start with the second record 'B'. And the process is repeated for 'B'. Like this , this process should be done for all the entries in the alternate key till end of file of the VSAM file is reached. This has to be done in COBOL. I have used Alternate key and secondary key position in an intermingled way. So please consider both same.
The following are my dilemas:-
1) Could you please let me know how can i do my file definition ? Should it be Dynamic or Sequential ?
2) How to use the START command ( If any i think it is needed as after getting the 'A' value i need to jump directly to next 'A' ) ?
3) To use READ or READ NEXT ?
Kindly if a sample code is given in the forum it would be great for me to undertand ?
Thanks in advance a lot !!!
Karun. |
|