ADELIA |
VADELIA |
SADELIA |
WADELIA |
MADELIA |
(I/B) |
(I/B) (S) |
(B) (S) |
(I/B) (S) |
(I) (S) |
Warning: In the case of ADELIA programs, this instruction is only compatible with the RPG generator.
Section for use
All
Syntax
UPD_SQL_C CursorName NullParameter MRParameter
NullParameter |
→ |
*NULL_IND | None |
MRParameter |
→ |
*NO_MR | *MR | None |
Description
This instruction updates the current record for the cursor CursorName.
This cursor must be declared with the *UPD option. Only those fields defined in the *UPD option are updated.
The *NULL_IND parameter allows you to take into account the management of NULL values when writing the lines. These values result from a reading operation or from the use of the SET_INDICATOR instruction.
The *MR parameter allows you to generate update 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 update 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
RNOOBJ='PGM_1'
UPD_SQL_C CURSOR_PGM
* Cursor declaration (Visual Adelia syntax) on the LINE_ORDER entity in the DECL PGM section
CURSOR CURS_LINE_ORDER *COND(LCUST_NAME = 'MILLER' AND LDATE_ORDER > '30/08/2004') -
*UPD (DLINE_AMOUNT)
...
OPEN_SQL_C CURS_LINE_ORDER
READ_NX_SQL_C CURS_LINE_ORDER
DO_WHILE *SQLCODE = *NORMAL
DLINE_AMOUNT = DLINE_AMOUNT * 0.8
UPD_SQL_C CURS_LINE_ORDER
READ_NX_SQL_C CURS_LINE_ORDER
REDO
CLOSE_SQL_C CURS_ORDER_LINE
* This program opens the cursor, reads all the matching records
* and updates them by reducing the amount line by 20%.
Other example
UPD_SQL_C CUST_CURS *NULL_IND
*NULL_IND allows null values to be taken into account.