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 Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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