Rational Developer for System z
PL/I for Windows, Version 8.0, Programming Guide

Using footprints for debugging

When debugging, it is useful to periodically check:

To accomplish these tasks, you can use built-in functions, PUT DATA and PUT LIST statements, and display statements. These approaches are described in more detail in the following sections.

Built-in functions
The built-in functions PROCNAME, PACKAGENAME, and SOURCELINE are useful in following the execution of your program when you are trying to track the location of a problem and the sequence of events that caused it. The following statement can be inserted wherever you want to display the procedure name and line number of the statement currently being executed.
  display (procname() || sourceline());
PUT LIST
Allows you to transmit strings and data items to the data stream (for example, to a printer-destined output file). For example, the following procedure lets you know if the FIXEDOVERFLOW condition is raised, and prints out the value of the variable that led to the condition (in this case, z):
  Debug: Proc(x);
     dcl x fixed bin(31);
     on fixedoverflow
        begin;
           put skip list('Fixedoverflow raised because z = '||z);
        end;
     end;
     get list(z);
     x = 8 * z;
  

If z is too large, multiplying it by 8 produces a value that is too large for any FIXED BIN(31) variable and would therefore raise the FIXEDOVERFLOW condition. PUT SKIP LIST transmits the data (in this case, the string "Fixedoverflow raised because z = ...") to the default file SYSPRINT. You can define SYSPRINT using export DD= statements. For more information on using SYSPRINT, see Using SYSIN and SYSPRINT files.

PUT DATA
Allows you to transmit the value of data items to the output stream. For example, if you specified the following line in your program, it would transmit the values of string1 and string2 to the output stream (for example, to SYSPRINT):
  put data (string1, string2);
DISPLAY
You can use DISPLAY to transmit information to your monitor. This can be useful to let you know how far a program has progressed, what procedure a program is running, and so on. For example:
  Display ('End of job!');
  Display ('Reached the MATH procedure');
  Display ('Hurrah! Got past the string manipulation stuff...');
Using DISPLAY with PUT statements results in output appearing in unpredictable order. For more information on using the DISPLAY statement, see DISPLAY statement input and output.

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)