ADELIA |
VADELIA |
SADELIA |
WADELIA |
EADELIA |
(I/B) |
(I/B) (S) |
(B) (S) |
(I/B) (S) |
(B) (S) |
Warning: In the case of ADELIA programs, this instruction is only compatible with the RPG generator.
Section for use
All
Syntax
DELETE_SQL_C CursorName Parameter
Parameter |
→ |
*NO_MR | *MR | None |
Description
This instruction deletes the current record from the cursor CursorName. This cursor must be declared with the *UPD option.
The *MR parameter allows you to generate deletion implicit management rules that are linked to the entity, even if the program is generated without the option to generate implicit management rules.
The *NO_MR parameter allows you not to generate deletion implicit management rules that are linked to the entity, even if the program is generated with the option to generate implicit management rules.
After this instruction has been run, it is possible to test the SQL return code with the *SQLCODE reserved word.
Important: On PC platforms, this instruction requires programs to be compiled in commitment control mode.
Example
* Declaration of cursor on ITEM entity in DECL PGM section (Visual Adelia syntax)
CURSOR CUR_ITM_TOY ITEMS *COND(AITM_TYP = 'TOY') *UPD
...
* Opens the cursor, reads matching records, which are inserted
* into the graphical list TOY_LST if the item price is below the limit; else
* the record is deleted in the database. At the end, cursor is closed.
OPEN_SQL_C CURS_ITM_TOY
READ_NX_SQL_C CUR_ITM_TOY
DO_WHILE *SQLCODE = *NORMAL
IF IPRICE < WLIMIT_PRICE
PRESENT ITEM
INSERT_ELT TOY_LST
ELSE
DELETE_SQL_C CURS_ITM_TOY
END
READ_NX_SQL_C CURS_ITM_TOY
REDO
CLOSE_SQL_C CURS_ITM_TOY