View previous topic :: View next topic
|
Author |
Message |
ursprasanna Warnings : 2 New User
Joined: 15 May 2006 Posts: 20 Location: chennai
|
|
|
|
Hi all,
I read a VSAM file with a help of an alternate key . The alternate key fetches me more than one recoed. can any one give me a logic such that i get the last record all the time for that particular key. For example my alternate key fetches 10 records .... I want only the 10 record .
If any one knows the logic . Please pass it on. |
|
Back to top |
|
|
Hanfur
Active User
Joined: 21 Jun 2006 Posts: 104
|
|
|
|
This would have easily be done if it was CICSCOB program by moving
HIGH-VALUES first to the ALTERNATE key.Then move the starting of Alternate Key valye in to the first two or three byte of same alternate Key thru reference move.
like
MOVE HIGH-VALUES TO ALT-KEY.
MOVE 'S' TO ALT-KEY(1:1).
Then issue CICS START BROWSE .The pointer will point to the just after to last record.
Then issuing READPREV will get the last record.
If it is in Batch VSAM program I feel ;u can still by setting upa counter first.
1.Then move first the partial key value .(say 'S')
2. issue START wil KEY > yourvalue.
3.Then Keep on issuing READ with NEXT option and each time increment the counter set up.
4.When counter reaches 10 stop reading.
Also here every time You need to check the data READ as the condition in START is '>'; hence would start reading'T' data once the data starting with 'S" is over .Also End of file condition too needs checking.
-Han. |
|
Back to top |
|
|
|