⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcs_rd_bk_q_yx.c

📁 unix 下用pro*c tuxedo 开发的东西
💻 C
字号:

/* Result Sets Interface */
#ifndef SQL_CRSR
#  define SQL_CRSR
  struct sql_cursor
  {
    unsigned int curocn;
    void *ptr1;
    void *ptr2;
    unsigned long magic;
  };
  typedef struct sql_cursor sql_cursor;
  typedef struct sql_cursor SQL_CURSOR;
#endif /* SQL_CRSR */

/* Thread Safety */
typedef void * sql_context;
typedef void * SQL_CONTEXT;

/* File name & Package Name */
struct sqlcxp
{
  unsigned short fillen;
           char  filnam[18];
};
static struct sqlcxp sqlfpn =
{
    17,
    "Pcs_RD_BK_Q_YX.pc"
};


static unsigned long sqlctx = 10224779;


static struct sqlexd {
   unsigned int   sqlvsn;
   unsigned int   arrsiz;
   unsigned int   iters;
   unsigned int   offset;
   unsigned short selerr;
   unsigned short sqlety;
   unsigned int   unused;
            short *cud;
   unsigned char  *sqlest;
            char  *stmt;
   unsigned char  **sqphsv;
   unsigned int   *sqphsl;
            short **sqpind;
   unsigned int   *sqparm;
   unsigned int   **sqparc;
   unsigned char  *sqhstv[1];
   unsigned int   sqhstl[1];
            short *sqindv[1];
   unsigned int   sqharm[1];
   unsigned int   *sqharc[1];
} sqlstm = {8,1};

/* Prototypes */
extern sqlcxt (/*_ void **, unsigned long *,
                   struct sqlexd *, struct sqlcxp * _*/);
extern sqlcx2t(/*_ void **, unsigned long *,
                   struct sqlexd *, struct sqlcxp * _*/);
extern sqlbuft(/*_ void **, char * _*/);
extern sqlgs2t(/*_ void **, char * _*/);
extern sqlorat(/*_ void **, unsigned long *, void * _*/);

/* Forms Interface */
static int IAPSUCC = 0;
static int IAPFAIL = 1403;
static int IAPFTL  = 535;
extern void sqliem(/*_ char *, int * _*/);

typedef struct { unsigned short len; unsigned char arr[1]; } VARCHAR;
typedef struct { unsigned short len; unsigned char arr[1]; } varchar;

/* cud (compilation unit data) array */
static short sqlcud0[] =
{8,4130,
2,0,0,1,0,0,31,101,0,0,0,0,1,0,
16,0,0,2,0,0,29,109,0,0,0,0,1,0,
};


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **
*	File name		: Pcs_Rd_BK_Q.x	                   		*
*	Module ID		:				          	*
*	Module Name		:                                             	*
*	Purpose			: save data from MQ to YX			*
*	Author             	: lix                                       	*
*	Date Created		: 1999,08,09                                    *
*	Version			: Version 1.0                                   *
*	Environment		: Digital UNIX                                  *
*	Portability		: UNIX Platform                                 *
*	Warnings		:                                              	*
*	References		:                                               *
*	Calling Syntax		:                                               *
*	Parameters		: None                                          *
*	Returns			: void                                          *
*	Calling Function	: the main function of pcs_rd_bk_q          	*
*	Called Functions	: 	                                  	*
*	Datastores and usages:                                                 	*     
*        	   (a) Input                                                   	*
* 	   (b) OutPut                                                          	*       
*	Report			: None                                          *
*	Screens			: None                                          *
*	Messages Files		: None                                          *
*	Change Log		:                                               *
*	Change No. 	Date	Author	Reason For Change                 	*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/

#include "stdio.h"
#include "stdlib.h"
#include "sqlcpr.h"
#include <fcntl.h>
#include <signal.h>
#include "/usr/bkfx/include/myapi.h"
#include "/usr/bkfx/include/Pcs_RD_BK_Q_x/Pcs_RD_BK_Q_YX.h"
#include "/usr/bkfx/include/Pcs_RD_BK_Q_x/yxapi.h"

void main( )
{
   	int ret_code=0,iTInterval;
   	long int buf_length;
	char *PID = "Client Txn Clt_Mpt Process(Port 7111)";
	char data_type[32];
	char produce_err_str[20];

	ERROR=0;
	signal(SIGTERM,freect);
	
	ProcessError(LOG_NORMAL,"PCS_RCV_YX: this is NORMAL message",END);
   
	iTInterval=GetTimeInterval("PCS_RCV_YX");
	
	ret_code=InitPcsRcvYX();
	if( ret_code !=0 )
	{
		ProcessError(LOG_ERROR,"PCS_RCV_YX: connect database error",END);
		exit(0);
	}
	
begin:
	NOT_CONNECT=0;
	ret_code = MQBKInit("YX");
    	if ( ret_code < 0 )
      	{
       		ProcessError(LOG_ERROR,"PCS_RCV_YX: Calling Funtion MQBKInit(YX) Failed!",END);
       		goto End;
      	}

	buf=(char *) malloc ( MAX*sizeof(char));
	if( buf==NULL )
	{
		ProcessError(LOG_ERROR,"PCS_RCV_YX: there is no space in memory",END);
		sleep(iTInterval);
		goto End;
	}
	for( ; ; )
	{
		buf[0]='\0';
  		ret_code = MQBKReceiveSyn_Wait( &buf_length, buf, data_type );
    		if ( ret_code < 0 )
      		{
       			break;
      		}

#ifdef	DEBUG
	PutintoF(buf);
#endif

      		if ( buf_length!=strlen(buf) )
      		{
      			ProcessError(LOG_ERROR,\
      				"PCS_RCV_YX: received buf length is not right",END);
      			break;
      		}

      		ret_code = PcsRcvYX( buf, buf_length);
      		if ( ret_code < 0 )
      		{
			myapi_ReadString(buf,produce_err_str,0,13);
         		ProcessError(LOG_ERROR,"PCS_RCV_YX: Calling Funtion PCSRcvYS() Failed! part msg is:",produce_err_str);
         		/* EXEC SQL ROLLBACK WORK; */ 

{
           struct sqlexd sqlstm;

           sqlstm.sqlvsn = 8;
           sqlstm.arrsiz = 0;
           sqlstm.iters = (unsigned int  )1;
           sqlstm.offset = (unsigned int  )2;
           sqlstm.cud = sqlcud0;
           sqlstm.sqlest = (unsigned char  *)&sqlca;
           sqlstm.sqlety = (unsigned short)0;
           sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
}


			if( NOT_CONNECT ==1 )
			{
				ProcessError(LOG_ERROR,"PCS_RCV_YX: database may be shutdown now!",END);
				goto End;
			}
         		continue;
      		}
      		/* EXEC SQL COMMIT WORK ; */ 

{
        struct sqlexd sqlstm;

        sqlstm.sqlvsn = 8;
        sqlstm.arrsiz = 0;
        sqlstm.iters = (unsigned int  )1;
        sqlstm.offset = (unsigned int  )16;
        sqlstm.cud = sqlcud0;
        sqlstm.sqlest = (unsigned char  *)&sqlca;
        sqlstm.sqlety = (unsigned short)0;
        sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
}


      	}
      	
      	free(buf);
End:
	ret_code=MQBKClear();
	if( ret_code < 0 )
	{
		ProcessError(LOG_ERROR,"PCS_RCV_YS: error when clear tuxedo",END);
	}

#ifdef DEBUG
	exit(0);
#endif
      	
      	sleep(iTInterval);
	goto begin;
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -