ADELIA |
VADELIA |
SADELIA |
WADELIA |
EADELIA |
(I/B) |
(I/B) (S) |
(B) (S) |
(I/B) (S) |
(BI) (S) |
Warning: In the case of ADELIA programs, this instruction is only compatible with the RPG generator.
Section for use
All
Syntax
CLOSE_SQL_C CursorName
Description
This instruction closes the cursor CursorName.
You have to close a cursor after reading it completely.
After this instruction has been run, it is possible to test the SQL return code with the *SQLCODE reserved word.
Example
* This program seeks and displays into a list the last amendment to an insured
* person's agreement(s)
* Cursor declaration on the AGREEMENTS entity in the DECL PGM section (Visual Adelia syntax):
CURSOR CURS_AGR_INSNAME AGREEMENTS *COND(AINSNAME = :FINSNAME) *SORT(CNUM_CON_CON *ASC)
...
or
* Cursor declaration on the AGREEMENTS entity (Adelia syntax):
DECL CURSOR CURS_AGR_INSNAME AGREEMENTS *COND(AINSNAME = :FINSNAME)
* In this program, cursor is opened, matching records are read, and
* then the cursor is closed
OPEN_SQL_C CURS_AGR_INSNAME
READ_NX_SQL_C CURS_AGR_INSNAME
DO_WHILE *SQLCODE = *NORMAL
PROCESS_BRK AMENDMENT_BRK
PRESENT AGREEMENTS
READ_NX_SQL_C CURS_AGR_INSNAME
PROCESS_TOTAL BRK_AMENDMENT
REDO
CLOSE_SQL_C CURS_AGR_INSNAME
...
* Declaration of a control break AAGREEMENT_NUMBER
BREAK AAGREEMENT_NUMBER *SQL
...