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
 
File read.. previous record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: File read.. previous record
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    Post subject: Hi
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    Post subject:
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    Post subject:
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    Post subject:
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    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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
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 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