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
 

 

Logic to read a VSAM file sequentially and randomly.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Wed Nov 04, 2009 11:23 pm    Post subject: Logic to read a VSAM file sequentially and randomly.
Reply with quote

Hi,

I have a requirement which states something like this:
KSDS of employee records and the hourly wage formed the record key. Also the program is interested in those employees earning $7 and $9 per hour and those earning $15 per hour and above.
In Input Output Section of Environment division I will declare it as:
SELECT file-name ASSIGN TO ddname
ORGANIZATION IS Indexed
ACCESS MODE IS Sequential
RECORD KEY IS key1

In the working storage section I define the key as the hourly wage.
Now while reading it sequentially it is fine. But if I have to read the file randomly how will I be able to do so as ACCESS MODE IS Sequential.
whereas if I declare it as ACCESS MODE IS Random how to read it sequentially. What I am trying to say is that if I have to read same file both sequentially and randomly how do I need to define in I-O section. Do i need to define twice this file in Environment division? This requirement is because my logic need to access the same file sequentially and randomly. Can someone give the snippet of the code.
Back to top
View user's profile Send private message

Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Nov 04, 2009 11:36 pm    Post subject:
Reply with quote

Hi Mr Banerjee...

Am just leaving my office now.. So cant help you with the any sample code.. icon_biggrin.gif

Anyway... you could have a look into the DYNAMIC access mode available... If my understanding of your requirement is correct, you could use the DYNAMIC option with a couple to condition checks and get the required o/p.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8054
Location: East Dubuque, Illinois, USA

PostPosted: Wed Nov 04, 2009 11:38 pm    Post subject:
Reply with quote

There is a link at the top of the page to the manuals. Click on it, find the COBOL Language Reference manual, and read up on ACCESS MODE IS DYNAMIC. You can also read about the different forms of the READ statement, and the START statement.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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