Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To read the last record using alternate key.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: To read the last record using alternate key.
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    Post subject: Hi,
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts CICS VSAM RLS READ akodakka CICS 3 Tue Oct 04, 2016 3:09 pm
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us