Debugging with MESSAGE and CONFIRM

The simplest debug method is to insert MESSAGE statements at key points in our logic. This is very simple and, if structured properly, provides us with a simple trace of the code logic path. We can number our messages to differentiate them and display any data (in small amounts) as part of a message like the following:

MESSAGE('This is Test 4 for %1',Customer."No.");

A big disadvantage is that MESSAGE statements do not display until processing either terminates or is interrupted for user interaction. Also, if you create a situation that generates hundreds of messages, you will find it quite painful to click through them individually at process termination.

If we force a user interaction at some point, then our accumulated messages will appear prior to the interaction. The simplest way to force user interaction is to issue a CONFIRM message in the format as follows:

IF CONFIRM ('Test 1',TRUE) THEN;

If we want to do a simple trace but want every message to be displayed as it is generated, (that is, have the tracking process move at a very measured pace), we could use CONFIRM statements for all the messages. The operator must then respond to each one before our program will move on but, sometimes, that is what we want. However, if we make the mistake of creating the situation where hundreds of messages are generated, the operator will have to respond to each one individually in what could be a very time consuming and inefficient process.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset