Function item_delete
This function deletes a row from the items
database table, based on
the values in the current record of the items array.
Function
item_delete
:01
FUNCTION
item_delete(curr_pa)
02
DEFINE
curr_pa SMALLINT
03
04
WHENEVER ERROR CONTINUE
05
DELETE FROM
items
06
WHERE
items.stock_num = arr_items[curr_pa].stock_num
07
AND
items.order_num = order_rec.order_num
08
WHENEVER ERROR STOP
09
10
IF
(SQLCA.SQLCODE == 0) THEN
11
MESSAGE
msg10
12
ELSE
13
ERROR
SQLERRMESSAGE
14
END IF
15
16
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
thru07
The embedded SQLDELETE
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 deleted.