View previous topic :: View next topic
|
Author |
Message |
kalais
New User
Joined: 18 Apr 2006 Posts: 22
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
jz1b0c
Active User
Joined: 25 Jan 2004 Posts: 160 Location: Toronto, Canada
|
|
|
|
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 |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
See if you can use VSAM KSDS - this will avoid repeated scanning of the file. |
|
Back to top |
|
|
kalais
New User
Joined: 18 Apr 2006 Posts: 22
|
|
|
|
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 |
|
|
|