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
 
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: 8165
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 Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

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