Progress_Learner
Member
Dear All,
I have created one scenario to increase Order quantity (in order-line) by 5 for all orders where customer number is 10. Below is code for the same:
This code is working fine but I have few doubts like:
Regards,
Learner
I have created one scenario to increase Order quantity (in order-line) by 5 for all orders where customer number is 10. Below is code for the same:
Code:
FIND customer WHERE customer.cust-num = 10 NO-LOCK NO-ERROR.
FOR EACH order WHERE order.cust-num = customer.cust-num NO-LOCK:
DO FOR order-line TRANSACTION:
FOR EACH order-line WHERE order-line.order-num = order.order-num EXCLUSIVE-LOCK:
order-line.qty = order-line.qty + 5.
FIND ITEM WHERE ITEM.item-num = order-line.item-num EXCLUSIVE-LOCK NO-ERROR.
ITEM.allocated = ITEM.allocated - 5.
END.
FIND CURRENT ITEM NO-LOCK.
END.
END.
This code is working fine but I have few doubts like:
- Should i created buffer for order-line and item table because I am updating records in both tables, is there any benefit of doing that.
- Can I use two tables with DO FOR (strong scope) block because two tables are getting updated in a single transaction.
- Is it fine to take order-line table with DO FOR block and downgrading the lock with FIND current for item table?
Regards,
Learner