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

📄 pcs_rd_bk_q_ys.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_YS.pc"
};


static unsigned long sqlctx = 10224739;


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,103,0,0,0,0,1,0,
16,0,0,2,0,0,31,115,0,0,0,0,1,0,
30,0,0,3,0,0,29,125,0,0,0,0,1,0,
};


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

*	File name		: PCS_RD_BK_Q.x	                                *				

*	Module ID		:				             *

*	Module Name	:                                                  *

*	Purpose		: Get GH Data from GHFile And Insert into DB       *

*	Author             : Li xun (DIMPT)                              *

*	Date Created	: 1999,07,27                                       *

*	Version		: Version 1.0                                      *

*	Environment	: Digital UNIX                                     *

*	Portability	: UNIX Platform                                    *

*	Warnings		:                                                  *

*	References	:                                                  *

*	Calling Syntax	:                                                  *

*	Parameters	: None                                             *

*	Returns		: void                                             *

*	Calling Function:                                                     *

*	Called Functions: When system startup                                 *

*	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 <sqlca.h>

#include <time.h>

#include <stddef.h>

#include <fcntl.h>

#include <signal.h>

#include "sqlcpr.h"

#include "/usr/bkfx/include/myapi.h"

#include "/usr/bkfx/include/Pcs_RD_BK_Q_x/Pcs_RD_BK_Q_YS.h"

#include "/usr/bkfx/include/Pcs_RD_BK_Q_x/ysapi.h"



void main( )

{

   	int ret_code,iTInterval,flag;

	char *PID = "Client Txn Clt_Mpt Process(Port 7111)";

	char data_type[32];
	char produce_err_str[25];
	

	ERROR=0;

	

	ProcessError(LOG_NORMAL,"PCS_RCV_YS: this is NORMAL message",END);



   	signal( SIGTERM,freect );

	flag=InitPcsRcvYS();

	if( flag!=0 )

	{

		ProcessError(LOG_ERROR,"PCS_RCV_YS: error when init function ", "PcsRcvYS");

		exit(0);

	}

   	

	iTInterval=GetTimeInterval("PCS_RCV_YS");

   

begin:
	NOT_CONNECT=0;
   	ret_code = MQBKInit("YS");

    	if ( ret_code < 0 )

      	{

       		ProcessError(LOG_ERROR,"PCS_RCV_YS: Calling Funtion MQBKInit() Failed!",END);

       		goto End;

      	}



	

	buf=(char *) malloc ( MAX_YSLEN*sizeof(char));

	if( buf==NULL )

	{

		ProcessError(LOG_ERROR,"PCS_RCV_YS: there is no space in memory",END);

		goto End;

	}

	for(;;)

	{

      		
  		ret_code = MQBKReceiveSyn_Wait( &buf_length, buf, "YS");

    		if ( ret_code < 0 )

      		{

       			break;

      		}

#ifdef	DEBUG
	PutintoF(buf);
#endif

      		if ( buf_length!=strlen(buf) )

      		{

      			ProcessError(LOG_ERROR,"PCS_RCV_YS: receive buf length is not right",END);

      			break;

      		}


                myapi_ReadString(buf,produce_err_str,0,21);
                ret_code=checkerr_sndgh(produce_err_str,buf[20]);
                if( ret_code < 0 )
		{
                          ProcessError(LOG_ERROR,"PCS_RCV_YS: Calling Function check error,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);
}


			continue;
		}

    		ret_code = PcsRcvYS( buf, buf_length );

      		if ( ret_code < 0 )

      		{

/*			myapi_ReadString(buf,produce_err_str,0,21);
			ret_code=checkerr_sndgh(produce_err_str,buf[20]);
			if( ret_code < 0 )
	         		ProcessError(LOG_ERROR,"PCS_RCV_YS: 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  )16;
           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_YS: 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  )30;
       sqlstm.cud = sqlcud0;
       sqlstm.sqlest = (unsigned char  *)&sqlca;
       sqlstm.sqlety = (unsigned short)0;
       sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
}


	
     	}

      	free(buf);

End:
	putitto_netwk();
	ret_code=MQBKClear();
	if( ret_code < 0 )
	{
		ProcessError(LOG_ERROR,"PCS_RCV_YS: error when clear tuxedo",END);
	}
#ifdef DEBUG
	printf("here exit normal\n");
	exit(0);
#endif

      	sleep(iTInterval);

	goto begin;


} 

⌨️ 快捷键说明

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