Open/Close and Handles Table I/O

KevinCourtney

Active Member
Hello,

I have questions about the Table I/Os that use the Open/Close and Handles. I have not come across these before.

I'm researching some performance issues in the Homebuilder module and have narrowed some log errors down to the N44H0058 F44H611ProcessBidTiers:

In the jde.log I find this:
Failed to validate Request handle

In the jdedebug.log:
Exiting JDB_CloseTable with Failure

In the code:
The Open Statement:
VA evt_idF44H611Handle_HF44H61 = F44H611.Open Handle

Several Fetch Singles
F44H611(VA evt_idF44H611Handle_HF44H61).Fetch Single

And at the end of the function, the Close statement:
F44H611(VA evt_idF44H611Handle_HF44H61).Close

I don't see too many options to change how these statements work but the log errors can't be helping performance.

Can any of you please pass on your knowledge of these Handles and is there an advantage to use them over just the standard Fetch Singles? Any ideas why the Close would be raising an error in the log?

Thanks,

Kevin
 
Handles are just pointers to the table so you can perform loops within loops etc.

Open close statements are there to manage database requests in the jobs memory. In my eyes, they should always be used by developers when coding.

I think of them as bubbles of memory that store selected records.
They are blown with an open statement and then popped with the close.

In E1 if you just code a select and fetch next, logs will show those command only (all that was selected remains in the jobs memory)

If you code a fetch single, the log will show OPEN, select, fetch, CLOSE (no data left in memory)

So what you should be doing is performing an open then your select and fetches, then closing.

Hope that makes sense?

http://www.jdelist.com/vb4/showthread.php/31002-Table-I-O-Using-Handles-vs-Fetch-Single
 
Last edited:
Hey Kevin,

In general Table Handles have always been a good thing - use of which is not a detriment to performance. Typically you use Table Handles to isolate select results and DB "cursors" from other code/activity against the same table in the same object.

If the error in the logs are in fact related to ER Table Handles (may not be) it could be because the ER Code is attempting to close the Table (using the handle) after its already been closed elsewhere -or - the table was never opened. Consider it a warning message - not something to lose sleep over.

Regarding the performance issues - check to see if the database table indices adequately support the Select Statements generated.

Also if looping (Select - Fetch Next) is taking place in the code I've seen some pretty dumb coding in my time - like looping through the entire table. Perhaps something like that is the issue.

Good Luck,
 
John & Larry,

Thanks for the quick replies, just what I was looking for.

Appreciate it,

Kevin
 
While using handles in a UBE, which event should we use to open and close handles??
 
Hi Pallavi,
Open and Close activities should be done once. Open before any Table I/O and close after the same. I have seen it put in Initialize and End event of the section.
I will suggest putting Open statement in DO event controlled by flags which executes only once. If the open is successful make sure that Close is executed as well.
 
Back
Top