Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: opening-closing a file vs. SELECTing directly to a table
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Wed Sep 26, 2007 4:36 pm    Post subject: Reply to: opening-closing a file vs. SELECTing directly to a
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    Post subject: Reply to: opening-closing a file vs. SELECTing directly to a
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Wed Nov 14, 2007 12:10 pm    Post subject: Reply to: opening-closing a file vs. SELECTing directly to a
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

Site Director


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

PostPosted: Wed Nov 14, 2007 8:30 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
This topic is locked: you cannot edit posts or make replies. Natural ADABAS Opening with CTS enikhilk Mainframe Jobs 0 Wed Nov 30, 2016 5:37 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us