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

Reseting file pointer to the 1st record once EOF is reached


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

New User


Joined: 13 Jul 2007
Posts: 9
Location: India

PostPosted: Fri Jul 13, 2007 11:29 am
Reply with quote

Hi

Am reading sequential file. I read a system date and check for a matching date in the file. If the date is not matching then i have to decrement the date by 1 and again scan the whole file for the new date. This processing needs to go on till i find the matching date in file.

Once i dont find the 1st date i need to reset the pointer to 1st record to scan it again from the start. Can you tell me any command which resets the pointer back to the first record.

Thanks for your help in advance.
Regards
Kamal
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jul 13, 2007 11:41 am
Reply with quote

Two commands, "CLOSE" followed by "OPEN".....
Back to top
View user's profile Send private message
dham.kamal

New User


Joined: 13 Jul 2007
Posts: 9
Location: India

PostPosted: Fri Jul 13, 2007 11:50 am
Reply with quote

William Thompson wrote:
Two commands, "CLOSE" followed by "OPEN".....


Williams thanks for your reply
But is there any other command to reset teh pointer.
Opening and closing a file seems to be very resource consuming.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jul 13, 2007 11:53 am
Reply with quote

Quote:
But is there any other command to reset teh pointer.
No, not a normal "flat" file.......
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Fri Jul 13, 2007 1:03 pm
Reply with quote

You don't say what you will do once you have found the appropriate record in the file, so there may be a 'better' way of doing this
eg could you sort the file in date order perhaps?

If you expand your requirements for us someone might come up with a good, resource friendly solution.
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Fri Jul 13, 2007 1:11 pm
Reply with quote

Hi Kamal,

Include sequence numbers at the end of each record through sort. Using the sequence number as the key, copy the records into a KSDS file. So, on reaching the EOF, move 00001 to the key, so that you can reach back to the first record.

Regards
Tanden
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top