Close cursors when SQL is embedded

This tip shows you how to close any open cursors in your program.

When you have embedded SQL in RPGLE programs, use default activation group *no and use cursors to read through...

your data, it is not enough to close any open cursors in your program. The default compile option on the CRTSQLRPGI command for Close SQL cursor is *ENDACTGRP (end activation group). When I used dftactgrp(*no) and was running in the QILE activation group my files remained open after the programs were done running because QILE was never ended. You must change the compile option for Close SQL cursor to *ENDMOD (end module) then all open cursors are closed when the module ends.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


This was last published in August 2002

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

Hello, What is the differences when Cursor used in SQL embedded for RPGLE or without, because with cursor the runtime execution was major.
Thanks
Cancel

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close