ADELIA |
VADELIA |
SADELIA |
WADELIA |
EADELIA |
(I/B) |
(I/B) (S) |
(B) (S) |
(I/B) (S) |
(B) (S) |
Section for use
All
Syntax
UPDATE ViewName Parameter
Parameter |
→ |
*NO_MR | *MR | None |
Description
This instruction corresponds to the update of a file record associated with the view ViewName.
The record must be read previously and must be available.
The *MR parameter allows you to generate update implicit management rules that are linked to the entity corresponding to the view, 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 corresponding to the view, even if the program is generated with the option to generate implicit management rules.
Example
* Pgm to print orders/customer (one break on customer code).
* This also updates the total per customer in a CUSTOMER file field.
READ ORDER
DO_WHILE ORDER EXISTS
PROCESS_BRK CUSTOMER_BK
CUSTOMER_AMOUNT = CUSTOMER_AMOUNT + LINE_AMOUNT
PRINT_VIEWS ORDER_LINE
READ ORDER
PROCESS_TOTAL CUSTOMER_BK
REDO
*
Heading procedure |
BREAK_PROCEDURE CUSTOMER_BK
CHAIN CUSTOMER
PRINT_VIEWS CUSTOMER_FMT
CUSTOMER_AMOUNT = 0
END_PROCESSING
*
Total procedure |
TOTAL_PROCEDURE CUSTOMER_BK
PRINT TOTAL_CUST
CUS_CURRENT_TTL = CUS_CURRENT_TTL + CUSTOMER_AMOUNT
UPDATE CUSTOMER
END_PROCESSING