View previous topic :: View next topic
|
Author |
Message |
Muthukumar.PLindia
New User
Joined: 03 Jul 2006 Posts: 51 Location: Chennai
|
|
|
|
Is there any concept to read the previous record of the file when we are in the current record and also going to the start of the file..without closing and ropening the file..... If there is any dynamic acccess of records can be done please info me...
Thanks in advance,
Muthu |
|
Back to top |
|
|
Hanfur
Active User
Joined: 21 Jun 2006 Posts: 104
|
|
|
|
Its there..
-Han. |
|
Back to top |
|
|
calspach
New User
Joined: 05 May 2006 Posts: 32 Location: USA
|
|
|
|
You can do a start browse, then read next or read prev.
Start Your-file key equal Beginning-key - This does not get a record.
Read Next Your-File - gets First record equal or greater than your beginning-key
Read Prev Your-File - gets previous record.
Now, if I remember right it works like this.
Records
1
2
3
4
5
Start Your-File key equal 3
Read Next Your File will retrieve record 3
Read Prev will retrieve record 3 again
Read Prev will retrieve record 2.
I think you have to do a read next before a read prev. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Read prev is a CICS/COBOL function. It's not available in batch. |
|
Back to top |
|
|
calspach
New User
Joined: 05 May 2006 Posts: 32 Location: USA
|
|
|
|
Ah yes, you are correct. I guess I've done more CICS lately.
So, about the only thing you could do would be to know the key structure. If it's simply a numeric key, you can reset the key to 0 to get to the beginning of the file, check the return code of the read, if it's not found, just increment until you get to the first record. To go backwards in a file, (read prev) just decrement until it is found. It's not a particularly fast way of doing it though. |
|
Back to top |
|
|
|