IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To read the last record using alternate key.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ursprasanna
Warnings : 2

New User


Joined: 15 May 2006
Posts: 20
Location: chennai

PostPosted: Mon Jul 03, 2006 6:23 pm
Reply with quote

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
View user's profile Send private message
Hanfur

Active User


Joined: 21 Jun 2006
Posts: 104

PostPosted: Tue Jul 04, 2006 1:14 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top