IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Logic to read a VSAM file sequentially and randomly.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 04, 2009 11:38 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top