Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us