Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10375
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: 10375
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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us