close considerations for SQL
In the context of SQL, the EGL close statement removes the result set that you created with an open or get...forUpdate statement.
EGL automatically removes the result set in these cases:
- A series of positional get statements (such as get next) ends with a noRecordFound condition.
- EGL runs a get statement for an SQL record when a single row is read and neither forUpdate nor singleRow was specified as an option.
- EGL runs a replace or delete statement that uses the cursor opened by a get...forUpdate statement.
- EGL begins to process an open or get statement for a record that is associated with an open cursor; the cursor is closed before the other processing takes place.
- The program runs sysLib.commit(), but the cursor is not closed if the hold option is in effect, as explained in relation to the open statement.
- The program reaches the end of a forEach loop.
Syntax
For a syntax diagram see the core close statement.
Example
The following is an example of a SQL close statement:
close myCustomer;
Compatibility
Each relational database management system (RDBMS) has its own version of SQL. Not all SQL commands are available in every implementation. Before coding any embedded SQL, see the documentation for your RDBMS.
The following table describes compatibility considerations for the close statement and SQL.
| Platform | Issue |
|---|---|
| CICS® | EGL closes all open result sets (even if the result set was opened with the hold option) when a converse statement runs in segmented mode. |
| IMS/VS | EGL closes all open result sets (even if the result set was opened with the hold option) whenever a converse statement runs. (IMS/VS programs are always segmented.) |