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

opening-closing a file vs. SELECTing directly to a table


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

New User


Joined: 05 Sep 2006
Posts: 30
Location: Philippines

PostPosted: Wed Sep 26, 2007 4:33 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Sep 26, 2007 4:36 pm
Reply with quote

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
View user's profile Send private message
pravin madoori

New User


Joined: 29 Jan 2007
Posts: 25
Location: Hyderabad

PostPosted: Wed Nov 14, 2007 11:33 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 14, 2007 12:10 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Nov 14, 2007 8:30 pm
Reply with quote

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
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 FTP VB File from Mainframe retaining ... JCL & VSAM 4
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
No new posts Load new table with Old unload - DB2 DB2 6
Search our Forums:

Back to Top