View previous topic :: View next topic
|
Author |
Message |
hallecodec
New User
Joined: 05 Sep 2006 Posts: 30 Location: Philippines
|
|
|
|
hi guys,
first, here is the scenario, REFERPROG uses two files: MAIN.INPUT and REFER.FILE.
UNLOADED.TABLE2.FILE gets its contents by unloading it from TABLE1, a DB2 table. REFERPROG will then load the data into an internal table/array for a faster processing. But data inside TABLE1 grows, and so the unloaded file will also grow, and the job/program will abend due to array overflow.
to address / to prevent the array overflow issue, we are considering these 2 options:
(1) REFER.FILE will not be loaded into the array. Meaning: once a record is read from MAIN.INPUT, it will open REFER.FILE, get the corresponding info, and close it in preparation for the next record of MAIN.INPUT. Opening and closing the REFER.FILE will be done repeatedly in EVERY record in MAIN.INPUT.
(2) once a record is read from MAIN.INPUT, it will SELECT directly to TABLE1. this process will be done also to EVERY record in MAIN.INPUT.
which do you think is more tedious when regards to performance? please advise. thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
The scenario might be clear for You....
what about sorting all the relevant files ???
what about a keyed access to the file being repeatedly opened and closed ???
regards
e.s |
|
Back to top |
|
|
pravin madoori
New User
Joined: 29 Jan 2007 Posts: 25 Location: Hyderabad
|
|
|
|
Can you do multiple open & close of a file?
Right now I am facing the below problem.
1. I have a INPUT file, tempFILE & outputFile. W e are trying to read logical bunch of records from INPUT file, writing them to TEMPFile. Now validating the TEMPFILE, now writing it to OUTPUTFILE. Let if we have 5 blocks of data in INPUT FILE, 5 times TEMPfile needs to be opened & closed. Now first time tempfile is working fine, but second time, after data is written to temp file, when trying to read it, it's returning EOF for first record. Can any one have an idea. Appreciate your help.
Sequence of file reads:
1. Open INPUT file input.
2.Open TEMPFILE file output.
3.Open OUTPUTFILE output.
4. write a first bunch of INPUT file recs to Temp file..
5. CLose TEMPFILE
6. Open TEMPFILE file input. do some validation.
7. write from TEMPFILE to OUTFILE.
8.CLOSE TEMPfile
4. write a first bunch of INPUT file recs to Temp file..
5. CLose TEMPFILE
6. Open TEMPFILE file input. do some validation.
7. write from TEMPFILE to OUTFILE.
8.CLOSE TEMPfile
.............
close all file. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
..... read logical bunch of records from INPUT file, writing them to TEMPFile. Now validating the TEMPFILE..... |
Why in &heaven don' t You simply validate the input file records along with the input read...
even if the validation logic encompasses more then one record,
from any point You look at it there is no difference in the logic of validating
validating from N to N+K-1 ( which means K records )
opposed to validating form 1 to K ( which, as above, means K records ) |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It is usually a bad idea to repeatedly open/close a file as you are describing.
If you post the actual requirement, we may be able to offer better suggestions.
What process requires writing these records to a tempfile? As Enrico mentions, the validation should be the same. |
|
Back to top |
|
|
|