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

File read.. previous record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Muthukumar.PLindia

New User


Joined: 03 Jul 2006
Posts: 51
Location: Chennai

PostPosted: Wed Jul 19, 2006 11:35 am
Reply with quote

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
View user's profile Send private message
Hanfur

Active User


Joined: 21 Jun 2006
Posts: 104

PostPosted: Wed Jul 19, 2006 1:10 pm
Reply with quote

Its there..

-Han.
Back to top
View user's profile Send private message
calspach

New User


Joined: 05 May 2006
Posts: 32
Location: USA

PostPosted: Wed Jul 19, 2006 6:57 pm
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Jul 20, 2006 9:17 pm
Reply with quote

Read prev is a CICS/COBOL function. It's not available in batch.
Back to top
View user's profile Send private message
calspach

New User


Joined: 05 May 2006
Posts: 32
Location: USA

PostPosted: Thu Jul 20, 2006 10:24 pm
Reply with quote

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
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top