13.07.2015 Views

IBM Flex System x240 w

IBM Flex System x240 w

IBM Flex System x240 w

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

eturn ( clientRc ) ;}// ----------------------------------------------------------------// Delivery CLIENT// ----------------------------------------------------------------int delivery_sql ( struct in_delivery_struct * in_delivery, struct out_delivery_struct * delivery ){struct sqlca sqlca ;EXEC SQL BEGIN DECLARE SECTION;struct vc_del_in{short len ;char data[ 14 ] ;} * in_del ;struct vc_del_out{short len;char data[ 50 ] ;} * out_del ;EXEC SQL END DECLARE SECTION;int clientRc = TRAN_OK ;int orderIndex = 0 ;in_del = (struct vc_del_in *) in_delivery ;in_del->len = sizeof(struct in_delivery_struct) - SPGENERAL_ADJUST;out_del = (struct vc_del_out *) delivery ;out_del->len = sizeof(struct out_delivery_struct) - SPGENERAL_ADJUST;#ifdef DEBUGITdel_debug(delivery, in_delivery, "Client before SP call");#endif /* DEBUGIT */#ifdef SWAP_ENDIANSWAP_BYTE(in_delivery->s_W_ID);SWAP_BYTE(in_delivery->s_O_CARRIER_ID);#endif //SWAP_ENDIANEXEC SQL CALL dels ( :*in_del, :*out_del ) ;#ifdef SWAP_ENDIANSWAP_BYTE(in_delivery->s_W_ID);SWAP_BYTE(in_delivery->s_O_CARRIER_ID);for (orderIndex=0; orderIndexs_O_ID[ orderIndex ]);}SWAP_BYTE(delivery->s_transtatus);SWAP_BYTE(delivery->deadlocks);#endif //SWAP_ENDIAN#ifdef DEBUGITdel_debug(delivery, in_delivery, "Client after SP call");#endif /* DEBUGIT */}if ( sqlca.sqlcode != 0 ){sqlerror( DELIVERY_SQL, "DEL", __FILE__, __LINE__, &sqlca) ;delivery->s_transtatus = FATAL_SQLERROR ;clientRc = FATAL_SQLERROR ;}if ( delivery->s_transtatus s_W_ID#define d_id in_stocklev->s_D_ID#define threshold in_stocklev->s_threshold#define low_stock stocklev->s_low_stockstocklev->deadlocks = -1 ;stocklev->s_transtatus = TRAN_OK ;#ifdef DEBUGITstk_debug(stocklev, in_stocklev, "Client before SQL call");#endif /* DEBUGIT */retry_tran:stocklev->deadlocks ++ ;EXEC SQL BEGIN COMPOUND NOT ATOMIC STATICSELECT COUNT( S_I_ID ) INTO :low_stock;FROM ( SELECT DISTINCT S_I_IDWITH CSCOMMIT ;) OLSEND COMPOUND ;FROM ORDER_LINE , STOCK , DISTRICTWHERE D_W_ID = :w_idAND D_ID = :d_idAND OL_O_ID < d_next_o_idAND OL_O_ID >= ( d_next_o_id - 20 )AND OL_W_ID = D_W_IDAND OL_D_ID = D_IDAND S_I_ID = OL_I_IDAND S_W_ID = OL_W_IDAND S_QUANTITY < :threshold#ifdef DEBUGITstk_debug(stocklev, in_stocklev, "Client after SQL call");#endif /* DEBUGIT */}if ( sqlca.sqlcode != 0 ){DLCHK( retry_tran ) ;}sqlerror( STOCKLEV_SQL , "STK" , __FILE__, __LINE__ , &sqlca);stocklev->s_transtatus = FATAL_SQLERROR ;clientRc = FATAL_SQLERROR ;stk_debug( stocklev, in_stocklev, "STK failed" ) ;EXEC SQL ROLLBACK WORK ;if ( sqlca.sqlcode != 0 ){sqlerror( STOCKLEV_SQL, "ROLLBACK FAILED", __FILE__, __LINE__, &sqlca ) ;}return ( clientRc ) ;Src.Common/Makefile################################################################################ Licensed Materials - Property of <strong>IBM</strong>#### (C) COPYRIGHT International Business Machines Corp. 1996, 2010## All Rights Reserved.#### US Government Users Restricted Rights - Use, duplication or## disclosure restricted by GSA ADP Schedule Contract with <strong>IBM</strong> Corp.##############################################################################

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!