1. Please Write a program that contains sub transaction, Keep in mind that sub transaction should update a date field and if the input date is greater than today, transaction should be aborted by the program itself.
DEFINE VARIABLE dtDate AS DATE NO-UNDO.
DEFINE VARIABLE cState AS CHARACTER NO-UNDO.
Main_TXN:
FOR FIRST customer EXCLUSIVE-LOCK :
ASSIGN cState = customer.state.
UPDATE cState.
ASSIGN Customer.State = cState.
FIND FIRST order OF customer EXCLUSIVE-LOCK NO-ERROR NO-WAIT.
IF NOT avail order THEN UNDO Main_TXN, LEAVE Main_TXN.
ELSE
DO:
ASSIGN dtDate = order.order-date.
UPDATE dtDate.
IF dtDate = ? OR dtDate > TODAY
THEN UNDO Main_TXN, LEAVE Main_TXN.
ASSIGN order.order-date = dtDate.
END.
END.