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

Rewind a sequential file in COBOL program


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

New User


Joined: 18 Apr 2006
Posts: 22

PostPosted: Thu Aug 09, 2007 8:23 pm
Reply with quote

Hi,

I need to search a sequential file repeatedly each time from the start of the file.
How I can achieve this without closing and opening the file each time.
Is there any options like Rewind for doing it?


Thanks,
Kalais
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 09, 2007 8:49 pm
Reply with quote

No rewind for dasd. you could considered tabling the sequential file, thus reducing the I/O.

But, why do you have to make repeated passes? A redesign solution may be provided if you can provide your requirements.
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Thu Aug 09, 2007 8:49 pm
Reply with quote

Sort the file on some key, (let there be duplicates- not an issue)

Now once you are at the end of the file, use START command to position it to the beginning of the file (use low-values in the key field).

I think you have to use access method dynamic for this.

Its been a long time, since I worked with files in cobol, I am not able to quote an example here, but I think this should work.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Aug 09, 2007 9:41 pm
Reply with quote

Full file searches are generally not a good thing if they are done repeatedly in program. The cpu performance and run time of your application is going to suffer greatly by doing this.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Aug 09, 2007 11:09 pm
Reply with quote

Hello,

If you explain why you need to search the file repeatedly, we may be able to offer far better performing alternatives.
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Fri Aug 10, 2007 10:31 am
Reply with quote

See if you can use VSAM KSDS - this will avoid repeated scanning of the file.
Back to top
View user's profile Send private message
kalais

New User


Joined: 18 Apr 2006
Posts: 22

PostPosted: Fri Aug 10, 2007 3:03 pm
Reply with quote

Hi,

I used a table for storing the sequntial file and did the search. The program got considerable improvement in performance.

Maximum no of records for that file will be below 5000 I hope.

Problem definition is that,
There are two sequential files FILE1 and FILE2 .
There will be a field in FILE1 with missing value. I need to search FILE2
using one or more key values(these keys for search will differ based on a field in FILE1) from FILE1 to find out the missing value.

(e.x)
FILE1
------
1.ACMABANO <missing field> PAP1 R PRDW ACMABANO
2.APFL905 <missing field> PAP1 L

If the field in BOLD is R ,search keys will be PRDW and ACMABANO
or if it is L search key will be the first field APFL905.

FILE2
------
1.ACMABANO PVSAM.CICS.ACMABANO PRDW L
2. APFL905 PVSAM.CICS.APFL905 PRDC L

The BOLD fields in FILE2 are the results of serach.


If anybody has better idea please let me know.

Please let me know if more clarification is needed.

Thanks,
Kalai
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 Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top