View previous topic :: View next topic
|
Author |
Message |
arindambanerjee
New User
Joined: 30 Jun 2007 Posts: 39 Location: India
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Mr Banerjee...
Am just leaving my office now.. So cant help you with the any sample code..
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|