Eugene, The first thing to do would be keep the job active and let it handle all requests. Regards to clearing/creating your QTEMP file, always chose the option that generates the fewest exceptions. So if some step is called multiple times such that most of the time the QTEMP file exists, but the first time it does not, then I would use the following code: CLRPFM QTEMP/MYTEMP MONMSG CPF3142 DO(CRTDUPOBJ xxxx) /* File Not Found */ This way, most of the time it is just the clrpfm that is executed. Regarding deleting all the records after the work unit and then doing CLRPFM, that is an extra step. I can't say for certain, but I would expect the single CLRPFM to be faster than deleteing individual records (especially if access paths are involved). So I would NOT delete the records as you send them back, and just do the CLRPFM. This has the added benefit that by opening in read-only mode, you allow better blocking to take place. Regards, Bob Crothers Cornerstone Communications http://www.cstoneindy.com -----Original Message----- From: firstname.lastname@example.org [mailto:email@example.com]On Behalf Of Eugene Astanovsky Sent: Friday, December 14, 2001 9:48 AM To: C400-L@midrange.com Subject: [C400-L] Optimization question Can someone give me an advise on hour to achieve maximum perfomance in the following case. I have a program, that is actually an API, called from PC via Client Access. This program is "seen" in WRKACTJOB under WRKSYS/QZRCSRVS. Program is called frequently and I have to maximize its speed. For its operation it requires a temporary PF, which is created in QTEMP by the program. What I do now in my C program is : CRTDUPOBJ OBJ(HZY041) FROMLIB(KFILEEK) TOLIB(QTEMP) OBJTYPE(*FILE) Program fills file with data, then sends data away, clearing this file as data is transferred. When program ends it's job, file is empty, as I delete each record after sending it. I looked at the job log, and each time it says : Object HZY041 in QTEMP type *FILE already exists. Now as performance is a bottleneck, I have several choices. 1. Leave it as is and find for a solutions somewhere else - I do not know if this is a performance issue :-( 2. Delete file as soon as it is empty - then I probably will not get this error message, but will have to create it for each call. 3. Check, if file exist before creating it and make CRTDUPOBJ only if the file does not exist. My question is which of the choices is the best? And if the best is nr.3, then what is the most efficient way to check the existence of the file? Any suggestions will be highly appreciated. Regards, Jevgeni Astanovski. _______________________________________________ This is the C programming iSeries / AS400 (C400-L) mailing list To post a message email: C400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/c400-l or email: C400-Lfirstname.lastname@example.org Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l.