Function item_update
This function updates a row in the items
database table using the
changes made to the current array record in the form.
Function
item_update
:01
FUNCTION
item_update(curr_pa)
02
DEFINE
curr_pa SMALLINT
03
04
WHENEVER ERROR CONTINUE
05
UPDATE
items SET
06
items.stock_num = arr_items[curr_pa].stock_num,
07
items.quantity = arr_items[curr_pa].quantity
08
WHERE
items.stock_num = arr_items[curr_pa].stock_num
09
AND
items.order_num = order_rec.order_num
10
WHENEVER ERROR STOP
11
12
IF
(SQLCA.SQLCODE == 0) THEN
13
MESSAGE
msg09
14
ELSE
15
ERROR
SQLERRMESSAGE
16
END IF
17
18
END FUNCTION
Note:
- Line
02
the index of the current row in the array is passed to this function and stored in the variablecurr_pa
. - Lines
05
thru09
The embedded SQLUPDATE
statement uses the value oforder_num
in the currentorder_rec
record, and the value ofstock_num
in the current row in thearr_items
array, to locate the row in theitems
database table to be updated.