RTP记录log的机制
我们 RCV 这边经常跑的一个concurrent request RTP: Receiving Transaction Processor, 主要是用来处理 RCV_TRANSACTIONS_INTERFACE 里面的数据的. 这个 concurrent program 里面包含许多文件, 比较重要的有: ident RVCTPRVCTP: $Header: rvctp.oc 120.0.120
我们 RCV 这边经常跑的一个concurrent request RTP: Receiving Transaction Processor, 主要是用来处理 RCV_TRANSACTIONS_INTERFACE 里面的数据的.
这个 concurrent program 里面包含许多文件, 比较重要的有:
ident RVCTP RVCTP: $Header: rvctp.oc 120.0.12000000.1 2007/01/16 23:53:49 appldev ship $ $Header: rvtbm.lpc 120.13.12010000.10 2013/03/15 02:51:16 zhlee ship $ $Header: rvtpt.lpc 120.28.12010000.33 2013/07/15 07:12:37 smai ship $ $Header: rvtvq.lpc 120.8.12010000.17 2013/04/03 11:40:30 wayin ship $ $Header: rvtuq.lpc 120.9.12000000.7 2009/07/07 09:47:49 YUZZHANG01 ship $ $Header: pouer.lpc 120.2 2006/06/14 07:57:02 arudas noship $ $Header: rvtlo.lpc 120.1.12010000.7 2013/01/05 16:02:14 gke ship $ $Header: rvtoc.lpc 120.1.12010000.5 2013/03/28 22:38:31 vthevark ship $ $Header: rvtpa.lc 120.6.12010000.3 2009/07/07 08:58:22 ksivasa ship $ $Header: rvtpd.lc 120.1.12010000.3 2009/07/07 09:03:17 ksivasa ship $ $Header: rvtsh.lpc 120.10.12010000.3 2009/03/06 22:09:40 vthevark ship $ $Header: rvtth.lpc 120.29.12010000.9 2012/05/30 15:50:03 gke ship $ $Header: rvtvt.lpc 120.9.12010000.10 2013/03/28 18:19:11 vthevark ship $ $Header: rvsco.lpc 120.4.12010000.12 2012/09/27 23:10:24 vthevark ship $ $Header: rvsrv.lpc 120.4.12010000.16 2013/02/04 07:34:37 zhizheng ship $ $Header: rvsit.lpc 120.5.12010000.6 2013/02/04 07:26:30 zhizheng ship $ $Header: rvsdl.lpc 120.5.12010000.17 2011/11/28 05:19:19 xiameng ship $ $Header: rvssh.lpc 120.2.12010000.3 2009/07/07 09:56:26 ksivasa ship $ $Header: rvsut.lpc 120.3.12010000.14 2012/05/28 04:53:57 gke ship $ $Header: rvtcl.lpc 120.6.12010000.3 2009/07/07 09:15:25 ksivasa ship $ $Header: rvtii.lpc 120.19.12010000.27 2013/08/14 09:58:23 gke ship $ $Header: rvtls.lpc 120.7.12010000.14 2012/01/30 12:31:22 ksivasa ship $ $Header: rvtoo.lpc 120.3.12010000.3 2009/07/07 09:08:40 ksivasa ship $ $Header: rvsrq.lpc 120.5.12010000.3 2009/07/07 09:53:56 ksivasa ship $ $Header: rvspo.lpc 120.3.12010000.3 2009/07/07 09:53:12 ksivasa ship $
这些文件是在 RTP log 里面经常见到的. 这里我们主要看看, 在这些文件中是用怎样的机制写 log 的.
首先, 要在要写日志的函数里面声明一个变量:
text strbuf[BUFLEN+1];
然后用下面的语句:
strcpy((char *)strbuf,""); sprintf((char *)strbuf,"RVTUQ:370 req_line_id %ld\n", (long)req_line_id); Debug(strbuf,TRUE,TRUE);
第一句把 strbuf 清空, 然后把后面的字符串和整型数写入 strbuf, 第三句 Debug 把 strbuf 写入日志. Debug 后面有两个参数:
#define Debug(message,check_sql_error,no_rows_is_error)
第二个参数 check_sql_error 表示 如果希望检查 SQL error, 就设为 TRUE, 否则设为 FALSE. no_rows_is_error 表示 是不是把 NO_DATA_FOUND 当做一个 error. 如果是, 设为TRUE.
Concurrent Request 里面的文件都是 .c 的代码, 如果里面要写SQL, 就要写一句:
EXEC SQL
EXEC SQL select transaction_id, unit_of_measure into :parent_trx_id, :rec_uom from rcv_transactions where transaction_type in ('RECEIVE','MATCH') start with transaction_id = :p_trx_id connect by transaction_id = prior parent_transaction_id;
为了捕获这句SQL 可能发生的错误, 我们在这句后面写一句:
pouersql("RVTUQ", "134", FALSE )
这里面有三个参数, routine, location, no_rows_is_err.
routine 表示SQL 发生错误的文件名, 上面的例子中是 RVTUQ.
location 表示SQL 发生错误的位置, 上面的例子中是 134. 这样我们看到日志里面的这个位置就很容易定位到这句SQL.
no_rows_is_err 表示 是不是把 NO_DATA_FOUND 当做 error 来处理. 上面的例子中我们没有当做 error.
在 pouersql 这个函数的内部, 会去sqlca 里面提取 sqlcode. sqlca 全称是: sql communications area, 是一个用来记录SQL 执行信息的地方. 每次执行一个SQL 都会返回 sqlcode. 如果sqlcode = 0, 那么表示没有错误. 如果 sqlcode > 0, 表示有exception, 如果 sqlcode < 0, 表示发生 error, 要rollback. 我们平时接触的error 都是小于0 的, 但是 NO_DATA_FOUND 是 大于0 的, 代码 1403. pousersql() 函数会去 sqlca 里面提取 sqlcode, 然后判断是否 sqlcode < 0 还是 sqlcode > 0, 如果判断小于0, 那么才把错误消息写入 message stack. 如果大于0, 并且参数里面 no_rows_is_err 设为 TRUE, 那么也会写如message stack.
每次执行一次 SQL 就会更新一次 sqlca, 所以这个结构只记录最近一次执行SQL 的信息 . 错误消息是记录在sqlca.sqlerrm.sqlerrmc 里面的. 所以会把这个里面的字符串写入message stack. 但是sqlerrmc 最多只能记录70 个字符, 所以如果错误消息很长的话, 就会被截断.
上面的SQL 发生错误的话, pouersql () 返回值为 TRUE. 那么在调用这个函数的地方, 比如 rvtpt.lpc 文件中, 就会捕捉到这个返回值, 判断返回值之后确定发生error 了, 就会调用:
pouertrace( "RVTUQ", "000", "rvtuqdebitmemo()" )
file: 表示发生错误的文件
location: 表示错误的位置
subroutine: 表示发生错误的函数.
上面我们提到, sqlerrmc 只能保存70 个字符. 如果错误消息多余70 个字符, 想要得到所有的错误消息的话, 就需要用 sqlglm() 函数. 在使用这个函数之前, 我们要确保 sqlcode < 0, 否则取出来的错误消息是前面的SQL 的消息.
if (pouersql("RVTUQ","019",TRUE)) { char msg[510]; size_t buf_len, msg_len; buf_len = sizeof (msg); sqlglm(msg, &buf_len, &msg_len); strcpy((char *)strbuf,""); sprintf((char *)strbuf,"RVTUQ:001 YU SQL ERROR %s \n", (text *) msg); Debug(strbuf,TRUE,TRUE); return( FALSE ); }

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Pinduoduo software provides a lot of good products, you can buy them anytime and anywhere, and the quality of each product is strictly controlled, every product is genuine, and there are many preferential shopping discounts, allowing everyone to shop online Simply can not stop. Enter your mobile phone number to log in online, add multiple delivery addresses and contact information online, and check the latest logistics trends at any time. Product sections of different categories are open, search and swipe up and down to purchase and place orders, and experience convenience without leaving home. With the online shopping service, you can also view all purchase records, including the goods you have purchased, and receive dozens of shopping red envelopes and coupons for free. Now the editor has provided Pinduoduo users with a detailed online way to view purchased product records. method. 1. Open your phone and click on the Pinduoduo icon.

Call recording in iPhone is often underestimated and is one of the most critical features of iPhone. With its simplicity, this feature is of vital importance and can provide important insights about the calls made or received on the device. Whether for work purposes or legal proceedings, the ability to access call records can prove invaluable. In simple terms, call history refers to the entries created on your iPhone whenever you make or receive a call. These logs contain key information, including the contact's name (or number if not saved as a contact), timestamp, duration, and call status (dialed, missed, or not answered). They are a concise record of your communication history. Call history includes call history strips stored on your iPhone

How to View Command History in Linux In Linux, we use the history command to view the list of all previously executed commands. It has a very simple syntax: history Some options for pairing with the history command include: Option description -c clears the command history for the current session -w writes the command history to a file -r reloads the command history from the history file -n Limit the number of output of recent commands Simply run the history command to see a list of all previously executed commands in a Linux terminal: In addition to viewing command history, you can also manage command history and perform modifications to previously executed commands , reverse search command history or even delete history completely

iPhone lets you add medications to the Health app to track and manage the medications, vitamins and supplements you take every day. You can then log medications you've taken or skipped when you receive a notification on your device. After you log your medications, you can see how often you took or skipped them to help you track your health. In this post, we will guide you to view the log history of selected medications in the Health app on iPhone. A short guide on how to view your medication log history in the Health App: Go to the Health App>Browse>Medications>Medications>Select a Medication>Options&a

C# Development Suggestions: Logging and Monitoring System Summary: In the software development process, logging and monitoring systems are crucial tools. This article will introduce the role and implementation suggestions of logging and monitoring systems in C# development. Introduction: Logging and monitoring are essential tools in large-scale software development projects. They can help us understand the running status of the program in real time and quickly discover and solve problems. This article will discuss how to use logging and monitoring systems in C# development to improve software quality and development efficiency. The role of logging system

How to log and monitor Java development projects 1. Background introduction With the rapid development of the Internet, more and more companies have begun to develop Java and build various types of applications. In the development process, logging and monitoring are an important link that cannot be ignored. Through logging and monitoring, developers can discover and solve problems in time to ensure the stability and security of applications. 2. The importance of logging 1. Problem tracking: When an application error occurs, logging can help us quickly locate the problem.

Use the math.Log2 function to calculate the base 2 logarithm of a specified number. In mathematics, the logarithm is an important concept that describes the exponential relationship of one number to another number (the so-called base). Among them, the base 2 logarithm is particularly common and is frequently used in the fields of computer science and information technology. In the Python programming language, we can calculate the base 2 logarithm of a number using the log2 function from the math library. Here is a simple code example: importmathdef

CSS reflow and repaint are very important concepts in web page performance optimization. When developing web pages, understanding how these two concepts work can help us improve the response speed and user experience of the web page. This article will delve into the mechanics of CSS reflow and repaint, and provide specific code examples. 1. What is CSS reflow? When the visibility, size or position of elements in the DOM structure changes, the browser needs to recalculate and apply CSS styles and then re-layout
