RECEIVEIAALQQVFLUSERID 0 INCLUDE SQLCA INCLUDE SQLDA BEGIN DECLARE SECTION END DECLARE SECTION WHENEVER NOT FOUND GO TO error WHENEVER SQLERROR GO TO error INSERT INTO USERID.RECEIVEDORDER (POSTEDFLAG, PRODNUMBER, RECEIVEDDATE, RECEIVEDNUMBER, RECEIVEDQUANTITY, TOTALCOST) VALUES ( :POSTEDFLAG:POSTEDFLAGIND , :PRODNUMBER:PRODNUMBERIND , :RECEIVEDDATE:RECEIVEDDATEIND , :RECEIVEDNUMBER, :RECEIVEDQUANTITY:RECEIVEDQUANTITYIND , :TOTALCOST:TOTALCOSTIND ) WHENEVER SQLERROR CONTINUE WHENEVER NOT FOUND GO TO error WHENEVER SQLERROR GO TO error UPDATE USERID.RECEIVEDORDER SET POSTEDFLAG = :POSTEDFLAG:POSTEDFLAGIND, PRODNUMBER = :PRODNUMBER:PRODNUMBERIND, RECEIVEDDATE = :RECEIVEDDATE:RECEIVEDDATEIND, RECEIVEDQUANTITY = :RECEIVEDQUANTITY:RECEIVEDQUANTITYIND, TOTALCOST = :TOTALCOST:TOTALCOSTIND WHERE RECEIVEDNUMBER = :RECEIVEDNUMBER WHENEVER SQLERROR CONTINUE WHENEVER NOT FOUND GO TO error WHENEVER SQLERROR GO TO error DELETE FROM USERID.RECEIVEDORDER WHERE RECEIVEDNUMBER = :RECEIVEDNUMBER WHENEVER SQLERROR CONTINUE WHENEVER NOT FOUND GO TO error WHENEVER SQLERROR GO TO error SELECT POSTEDFLAG, PRODNUMBER, RECEIVEDDATE, RECEIVEDNUMBER, RECEIVEDQUANTITY, TOTALCOST INTO :POSTEDFLAG:POSTEDFLAGIND , :PRODNUMBER:PRODNUMBERIND , :RECEIVEDDATE:RECEIVEDDATEIND , :RECEIVEDNUMBER, :RECEIVEDQUANTITY:RECEIVEDQUANTITYIND , :TOTALCOST:TOTALCOSTIND FROM USERID.RECEIVEDORDER WHERE RECEIVEDNUMBER = :RECEIVEDNUMBER WHENEVER SQLERROR CONTINUE WHENEVER NOT FOUND GO TO notfound WHENEVER SQLERROR GO TO error DECLARE c1 CURSOR FOR SELECT POSTEDFLAG, PRODNUMBER, RECEIVEDDATE, RECEIVEDNUMBER, RECEIVEDQUANTITY, TOTALCOST FROM USERID.RECEIVEDORDER OPEN c1 FETCH c1 INTO :POSTEDFLAG:POSTEDFLAGIND , :PRODNUMBER:PRODNUMBERIND , :RECEIVEDDATE:RECEIVEDDATEIND , :RECEIVEDNUMBER, :RECEIVEDQUANTITY:RECEIVEDQUANTITYIND , :TOTALCOST:TOTALCOSTIND CLOSE c1 WHENEVER SQLERROR CONTINUE WHENEVER NOT FOUND GO TO notfound WHENEVER SQLERROR GO TO error PREPARE s1 FROM :_buf DECLARE c2 CURSOR FOR s1 OPEN c2 FETCH c2 INTO :POSTEDFLAG:POSTEDFLAGIND , :PRODNUMBER:PRODNUMBERIND , :RECEIVEDDATE:RECEIVEDDATEIND , :RECEIVEDNUMBER, :RECEIVEDQUANTITY:RECEIVEDQUANTITYIND , :TOTALCOST:TOTALCOSTIND CLOSE c2 WHENEVER SQLERROR CONTINUE POSTEDFLAG POSTEDFLAGIND PRODNUMBER PRODNUMBERIND RECEIVEDDATE RECEIVEDDATEIND RECEIVEDNUMBER RECEIVEDQUANTITY RECEIVEDQUANTITYIND TOTALCOST TOTALCOSTIND