01 WORK-FIELDS.
05 TABLE-NAME PIC X(18).
05 CUSTNO PIC X(6).
05 DEL-STMT.
49 DEL-STMT-LEN PIC S9(4) COMP VALUE +320.
49 DEL-STMT-TEXT PIC X(230).
B010-PROCESS-ROW.
PERFORM B110-ACCEPT-TABLE-NAME.
IF NOT EOF-ACCEPT
PERFORM B120-ACCEPT-CUSTNO
END-IF.
IF NOT EOF-ACCEPT
PERFORM B210-DELETE-CUST
END-IF.
(Need to check the whether to the end of ACCEPT after every accept execution)
B210-DELETE-CUST.
MOVE SPACE TO DEL-STMT-TEXT.
STRING 'DELETE FROM TOUGH.' TABLE-NAME
'WHERE INVNO= ''' INVNO ''''
DELIMITED BY SIZE
INTO DEL-STMT-TEXT.
DISPLAY 'SQL: ' DEL-STMT-TEXT.
EXEC SQL
EXECUTE IMMEDIATE :DEL-STMT
END-EXEC.
(1)
EXEC SQL
COMMIT
END-EXEC.
If the program stop run without commit after execution of the above sql statment, the sqlcode=00000010M.