× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Jeff,

you have to distinguish between implicit and explicit closes.
A cursor gets explicitely closed as soon as one of the following
SQL-statements is performed:
CLOSE, COMMIT or ROLLBACK (without hold)

A cursor gets implicitely (or hard) closed at either the end of the
activation group or at the end of a module (in ILE), depending on what is
specified in the CLOSQLSRC option in the compile command (CRTSQLRPGI) or in
an SET OPTION statement embedded in your source code.
*ENDACTGRP is the default value and hard closes the cursor at the end of the
activation group.
*ENDMOD will hard close the cursor at the end of the module.
(For RPGIII options *ENDJOB, *ENDPGM and *ENDSQL are available)

For performance issues, you should prefer *ENDACTGRP.
The first time an SQL statement gets executed the access plans stored in the
program object (if static SQL, otherwise the access plan gets built from
scratch) gets validated and the optimal access path gets determined and
used. The second time the same SQL statement gets executed, the access plans
are checked again and either confirmed or an other access path gets
determined. If the access path is reusable, the Opend Data Path stays open
after the second execution and gets used each time the SQL statement gets
executed (no overhead of access plan validation and optimization any more)

If you hard close the cursor at the end of the module, the complete
procedure of validating access plans, determining the optimal access path
and opening the access path must be performed each time the SQL-statement
gets executed.

By the way up to 512 ODPs per job can be opened, if additionals are used,
the ODP that was not used for the longest time gets closed.

Mit freundlichen Gruessen / Best regards

Birgitta

"Shoot for the moon, even if you miss, you'll land among the stars."
(Les Brown)

-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Jeff Young
Gesendet: Mittwoch, 22. Marz 2006 19:50
An: midrange-l@xxxxxxxxxxxx; rpg400-l@xxxxxxxxxxxx
Betreff: Closing files opened by SQL


I have an SQLRPGLE program running in a named activation group.
  The program uses SQL to select data using a cursor, update data based on
host variables and insert data using host variables.
  Before returning at the end of the program, I issue a CLOSE for the SQL
Cursor.
  When the program completes, I check my list of open files and I see all
the tables used in the program are still open.
  In order to close them, I must do a RCLACTGRP.
Is there another method to close these files when I am finished with them?

  Thanks,



Jeff Young
Sr. Programmer Analyst
Dynax Solutions, Inc.
A wholly owned subsidiary of enherent Corp.
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions
V5R2
IBM  Certified Specialist- e(logo) server i5Series Technical Solutions
Designer V5R3
IBM  Certified Specialist- e(logo)server i5Series Technical Solutions
Implementer V5R3












---------------------------------
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.