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

📄 pcs_snd_cancel_p.c

📁 unix 下用pro*c tuxedo 开发的东西
💻 C
📖 第 1 页 / 共 3 页
字号:
              		rtn_code = MQBKCmit();
       			if ( rtn_code < 0 ) 
	       		{
				ProcessError(LOG_ERROR,"Pcs_Snd_Cancel_P.x: Commit Cancel \
						Message Error!",END);
	       	      		MQBKBack();
                  		MQBKClear();
              			exit(-1);
       	      		}
       	      		
                        /* EXEC SQL UPDATE t_fsrz SET sjzt ='5', jssj =sysdate
         				WHERE FSXH =:fsxh; */ 

{
                        struct sqlexd sqlstm;

                        sqlstm.sqlvsn = 8;
                        sqlstm.arrsiz = 3;
                        sqlstm.stmt = "update t_fsrz  set sjzt='5',jssj=sys\
date  where FSXH=:b0";
                        sqlstm.iters = (unsigned int  )1;
                        sqlstm.offset = (unsigned int  )178;
                        sqlstm.cud = sqlcud0;
                        sqlstm.sqlest = (unsigned char  *)&sqlca;
                        sqlstm.sqlety = (unsigned short)0;
                        sqlstm.sqhstv[0] = (unsigned char  *)&fsxh;
                        sqlstm.sqhstl[0] = (unsigned int  )4;
                        sqlstm.sqindv[0] = (         short *)0;
                        sqlstm.sqharm[0] = (unsigned int  )0;
                        sqlstm.sqphsv = sqlstm.sqhstv;
                        sqlstm.sqphsl = sqlstm.sqhstl;
                        sqlstm.sqpind = sqlstm.sqindv;
                        sqlstm.sqparm = sqlstm.sqharm;
                        sqlstm.sqparc = sqlstm.sqharc;
                        sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
                        if (sqlca.sqlcode < 0) goto sqlerror;
}

  
                        
        	}	/* end of for */
        	
        	/* EXEC SQL CLOSE cur_rz; */ 

{
         struct sqlexd sqlstm;

         sqlstm.sqlvsn = 8;
         sqlstm.arrsiz = 3;
         sqlstm.iters = (unsigned int  )1;
         sqlstm.offset = (unsigned int  )196;
         sqlstm.cud = sqlcud0;
         sqlstm.sqlest = (unsigned char  *)&sqlca;
         sqlstm.sqlety = (unsigned short)0;
         sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
         if (sqlca.sqlcode < 0) goto sqlerror;
}

        
      		/* EXEC SQL COMMIT; */ 

{
        struct sqlexd sqlstm;

        sqlstm.sqlvsn = 8;
        sqlstm.arrsiz = 3;
        sqlstm.iters = (unsigned int  )1;
        sqlstm.offset = (unsigned int  )210;
        sqlstm.cud = sqlcud0;
        sqlstm.sqlest = (unsigned char  *)&sqlca;
        sqlstm.sqlety = (unsigned short)0;
        sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
        if (sqlca.sqlcode < 0) goto sqlerror;
}

    
        	
          }	/* end of else */
          
    }	/* end of while */
          
 	return(1); 
       
	sqlerror:
	ProcessError(LOG_ERROR,"Pcs_Snd_Cancel_P.x: Running Function PCSSndCancel() \
				SQL Error!",END);
	if ( MsgQX != NULL ) free(MsgQX);
	/* EXEC SQL ROLLBACK; */ 

{
 struct sqlexd sqlstm;

 sqlstm.sqlvsn = 8;
 sqlstm.arrsiz = 3;
 sqlstm.iters = (unsigned int  )1;
 sqlstm.offset = (unsigned int  )224;
 sqlstm.cud = sqlcud0;
 sqlstm.sqlest = (unsigned char  *)&sqlca;
 sqlstm.sqlety = (unsigned short)0;
 sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
 if (sqlca.sqlcode < 0) goto sqlerror;
}


	return(-1); 
}


int SetPCSSndCancel()
{

	/* EXEC SQL WHENEVER SQLERROR GOTO sqlerror; */ 

	
 	if ( (MsgQX = (char *)malloc (LEN_MsgQX)) == NULL )
 	{
 		ProcessError(LOG_ERROR,"Pcs_Snd_Cancel_P.x: Malloc Cancel Buffer \
 					Error!",END);
 		return ( -1);
 	}
 	memset(MsgQX, '\0', LEN_MsgQX);
 	
 	/* EXEC SQL SELECT bsbh into :fssjbh FROM t_bsbh; */ 

{
  struct sqlexd sqlstm;

  sqlstm.sqlvsn = 8;
  sqlstm.arrsiz = 3;
  sqlstm.stmt = "select bsbh into :b0  from t_bsbh ";
  sqlstm.iters = (unsigned int  )1;
  sqlstm.offset = (unsigned int  )238;
  sqlstm.selerr = (unsigned short)1;
  sqlstm.cud = sqlcud0;
  sqlstm.sqlest = (unsigned char  *)&sqlca;
  sqlstm.sqlety = (unsigned short)0;
  sqlstm.sqhstv[0] = (unsigned char  *)fssjbh;
  sqlstm.sqhstl[0] = (unsigned int  )3;
  sqlstm.sqindv[0] = (         short *)0;
  sqlstm.sqharm[0] = (unsigned int  )0;
  sqlstm.sqphsv = sqlstm.sqhstv;
  sqlstm.sqphsl = sqlstm.sqhstl;
  sqlstm.sqpind = sqlstm.sqindv;
  sqlstm.sqparm = sqlstm.sqharm;
  sqlstm.sqparc = sqlstm.sqharc;
  sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
  if (sqlca.sqlcode < 0) goto sqlerror;
}


        fssjbh[2] = '\0';
 	
 	strcpy( MsgQX, c_fsxh);
 	strcat( MsgQX, fssjbh);
 	strcat( MsgQX, jssjbh); 

	#ifdef DEBUG
		printf("fsxh, fssjbh, jssjbh is: %s, %s, %s \n",c_fsxh,fssjbh,jssjbh);
	#endif
 	return(1);
 	
 	sqlerror:
 	ProcessError(LOG_ERROR,"Pcs_Snd_Cancel_P.x: Running Function SetPCSSndCancel() \
 				SQL Error!",END);
 	free( MsgQX );
 	/* EXEC SQL RollBack; */ 

{
  struct sqlexd sqlstm;

  sqlstm.sqlvsn = 8;
  sqlstm.arrsiz = 3;
  sqlstm.iters = (unsigned int  )1;
  sqlstm.offset = (unsigned int  )256;
  sqlstm.cud = sqlcud0;
  sqlstm.sqlest = (unsigned char  *)&sqlca;
  sqlstm.sqlety = (unsigned short)0;
  sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
  if (sqlca.sqlcode < 0) goto sqlerror;
}


  	return(-1);
 
}


void itoa(long The_int_data, char* The_out_string, int j)
{
	char exch_str[12];
	char a;
	int i=0, n, the_mod;
	The_out_string[0]='\0';
	
	/* if the int varible is zero, then ...*/
	if (The_int_data==0)
	{
		exch_str[0]='0';
		exch_str[1]='\0';
		
		
		strcat( The_out_string, exch_str);
		for(n=1;n<j-1;n++)
		The_out_string[n]=' ';
		The_out_string[n]='\0';
		return;
	}
	
	
            while (1)
	        {
		
		the_mod = The_int_data%10;
		exch_str[i] = (char )(the_mod+48);
		exch_str[i+1] = '\0';
		i++;
		
		/* change the last digit to char */
		if((The_int_data = (The_int_data/10))<10) 
		     {
			exch_str[i] = (char)(The_int_data+48);
			exch_str[i+1] = '\0';
			goto over;
                        }
                   }
	
	/* overturn the order */
over:	for(n=0;n<=i;n++)
	The_out_string[n] = exch_str[i-n];
	for(n=i+1;n<j-1;n++)
	The_out_string[n]=' ';
	The_out_string[n]='\0';
}


/*Get the Time_Interval specified in the file and return it */
int GetTimeInterval(char* cType)
{
	FILE *hTimeInterval;
	char cLine[MAX_LINE_LEN+1], cCaption[100], cValue[21];
	int iInterval, i;
	char* pLine;
	
	 
	hTimeInterval = fopen( CONFIG_FILE_FOR_TIMEINTERVAL, "r" );
	if( hTimeInterval == NULL )
	{
		ProcessError(LOG_ERROR,   "GetTimeInterval: this is %s message:Cannot open file: %s,The file may not exist!",  "ERROR", CONFIG_FILE_FOR_TIMEINTERVAL);
		return(DEFAULT_TIMEINTERVAL);  
	}
	
	while( myapi_ReadALine( cLine, hTimeInterval ) )
	{
		if( cLine[0] == '#' ) continue;
		if( cLine[0] == NULL ) continue;
		
		pLine = cLine;
		while( (*pLine == ' ') || (*pLine == '\t') ) pLine++;
		i=0;
		while( (*pLine != ' ') && (*pLine != '\t') && (*pLine != '\0') )
		{
			cCaption[i] = *pLine;
			i++;
			pLine++;
		}
		
		cCaption[i] = '\0';
		if( strcmp( cCaption, cType ) == 0 ) /*Match*/
		{
			while( (*pLine == ' ') || (*pLine == '\t') ) pLine++;
			if( *pLine == '\0' )
				return(DEFAULT_TIMEINTERVAL);
			i=0;
			while( (*pLine != ' ') && (*pLine != '\t') && (*pLine != '\0') )
			{
				cValue[i] = *pLine;
				i++;
				pLine++;
			}
			cValue[i] = '\0';
			iInterval = atoi(cValue);
			
			if(iInterval <= 0) 		
			{
				return(DEFAULT_TIMEINTERVAL);
			}
			else
				return(iInterval);
		}
		else
			continue;
	}
	fclose( hTimeInterval );
	return(DEFAULT_TIMEINTERVAL);
}

/*Read a line to a string from a file, \n is excluded.
  return 1 if sucessful, 0 otherwise
  Do not close the file.*/
int myapi_ReadALine( char* cLine, FILE* hTable )
{
	char cChar;
	int i=0;
	cLine[0] = '\0';
	while( (cChar = fgetc( hTable )) != '\n' )
	{
		if( cChar == EOF ) return(0);
		cLine[i++] = cChar;
		
		
		if( i >= MAX_LINE_LEN ) i=0;
		cLine[i] = '\0';
	}
	return(1);
}

void ProcessError( char *LOG, char *sErrorMessage1, char *sErrorMessage2 )
{
	FILE* hErrorFile;
	char cDateTime[100],tempstr[100];
	int i,j,len,n;
	
	tempstr[0]='\0';
	len=strlen(sErrorMessage1);
	for(i=0;i<=len;i++)
	{
		if(sErrorMessage1[i]=='%')
		{			
			n=i;
			if(len!=i+1)
			{
				for(j=0;j<200&&sErrorMessage1[i+2]!='\0';j++,i++)
				tempstr[j]=sErrorMessage1[i+2];
				tempstr[j]='\0';
			}	
			break;
		}
		if(sErrorMessage1[i]=='\0')
		{
			n=i;
			tempstr[0] = '\0';
			break;
		}
			
	}
	
	
	sErrorMessage1[n]='\0';
	hErrorFile = fopen( ERROR_LOG_FILE, "a" );
	if( hErrorFile == NULL )
	{
		printf( "Critical! Cannot open ERROR_LOG_FILE for append or cannot create!\n");
		return;
	}
	fseek( hErrorFile, 0 ,SEEK_END );
	fputs( "\n",hErrorFile);
	fputs( LOG ,hErrorFile);
	printf("\n%s",LOG);
	fputs( sErrorMessage1,hErrorFile );
	printf("%s",sErrorMessage1);
	fputs( sErrorMessage2,hErrorFile );
	printf("%s",sErrorMessage2);
	fputs( tempstr,hErrorFile );
	printf("%s\n",tempstr);
	fputs( "\n",hErrorFile);
	fclose( hErrorFile );
	sprintf( cDateTime, "date >> %s\n", ERROR_LOG_FILE );
	system( cDateTime );
}

⌨️ 快捷键说明

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