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
 

 

In VSAM, Is there any utility to search the highest key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
richie_techin

New User


Joined: 21 Jan 2006
Posts: 16
Location: india

PostPosted: Thu Feb 22, 2007 11:49 am    Post subject: In VSAM, Is there any utility to search the highest key
Reply with quote

Hi,

In VSAM, Is there any utility to search the highest key?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Mar 05, 2007 7:40 am    Post subject:
Reply with quote

Hello,

There may not be a simple COBOL answer for your requirement.

This was found in another forum
Quote:
I need to read a VSAM/KSDS file backwards. We do this all the time with Assembler I/O modules, but we can't find a READ PREVIOUS verb in the Cobol language that the compiler will accept.

Is is possible to read a VSAM/KSDS file backwards in Cobol?

and the response was:
Quote:
The READ file-name PREVIOUS is NOT in the current version of COBOL unless you are using a 2002 compatible COBOL, like Microfocus NET EXPRESS 4.0 or later. Even IBM's newest Enterprise COBOL 3.4 does not do this yet. (I have the manual.)
It is supported in CICS via a browse with GET PREVIOUS.

If you don't have to read a lot of data, such as just 1 or 2 records prior to some other record you can write an almost there routine: (You really need to understand your data and key relationships)

READ file-name
Decrement some right most key value by some value
and then:
Start FILE-NAME key is record-key
read next file-name
(you need to keep track of the results and check for when you have the record you started with, etc.)
Kluggy at best.
Otherwise, if you need a lot of this, create an alternate key value in binary-inverted sequence and do a read next on the binary-inverted key value.


If you or someone in your group knows assembler, that may be a way to go. Adding an inverted key would work, but may not be desirable - you will need to determine a "good" solution for you environment.

Good luck and let us know how you meet the requirement icon_smile.gif
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 -> JCL & VSAM 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 recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts Underlying DB2 VSAM LDS - SMF recording vasanthz All Other Mainframe Topics 6 Thu Jan 05, 2017 4:20 am
No new posts TAPE VERIFY utility?? MrExtraordinare JCL & VSAM 3 Fri Dec 09, 2016 10:57 pm
No new posts BWO option in VSAM blayek CICS 3 Sat Nov 05, 2016 10:47 am
No new posts VSAM define for large file jerryte JCL & VSAM 9 Wed Oct 05, 2016 1:51 am


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