DEFINE VARIABLE hAppSrv AS HANDLE NO-UNDO.
DEFINE VARIABLE hOrder AS HANDLE NO-UNDO. DEFINE VARIABLE iOrderNum AS LIKE Order.Order-Num NO-UNDO. DEFINE VARIABLE lReturn AS LOGICAL NO-UNDO. DEFINE TEMP-TABLE ttOrder LIKE Order. DEFINE TEMP-TABLE ttOrderLine LIKE Order-Line. CREATE SERVER hAppSrv. lReturn = hAppSrv:CONNECT("-AppService inventory -S 5162 -H zeus", "SMITH", "STARSHIP"). IF NOT lReturn THEN DO: DELETE OBJECT hAppSrv NO-ERROR. RETURN ERROR "Failed to connect to AppServer". END. IF ERROR-STATUS:ERROR THEN DO: DELETE OBJECT hAppSrv NO-ERROR. RETURN ERROR RETURN-VALUE. END. . . . RUN order.p ON hAppSrv TRANSACTION DISTINCT PERSISTENT SET hOrder. RUN GetExistingOrder IN hOrder (iOrderNum, OUTPUT TABLE ttOrder, OUTPUT TABLE ttOrderLine) NO-ERROR. IF ERROR-STATUS:ERROR THEN DO: lReturn = hAppSrv:DISCONNECT(). DELETE OBJECT hAppSrv NO-ERROR. RETURN ERROR RETURN-VALUE. END. . . . lReturn = hAppSrv:DISCONNECT(). DELETE OBJECT hAppSrv NO-ERROR. |