PslDebug — Run-Time Error Checking Variable

The PslDebug built-in local variable provides a run-time error checking
and trace facility that detects a variety of common PSL coding errors.
You can enable or disable run-time checking and/or tracing by equating
PslDebug to a numeric value representing 1 or more of 16
error-checking flag bits.
The trace data produced by the PslDebug trace flags is useful in
debugging PSL programs during the initial stages of programming or as a
“pre-debug” before calling the more powerful (and hence more time
consuming) PSL debugger.
The general arrangement of the flags is as follows:
• error checking: 0-128
• tracing: 256-16384
The format of PslDebug within a PSL script is identical to that of any
other PSL variable:
PslDebug = n;

Value Definition
PslDebug Enable All Error Checking and Tracing:
–1 Enable all PSL run-time error checking and tracing functions. Setting
PslDebug = -1 is equivalent to setting all error checking and tracing flag
bits, or setting PslDebug = 257 (1 + 256 enables all error checking and all
tracing flag bits).
PslDebug Enable/Disable All Error Checking:
0 Disable all run-time error checking.
1 Enable all PSL run-time error checking. Setting PslDebug = 1 is equivalent
to setting all error checking flag bits.



Numeric Operation Warnings:
2 Enable warnings when arithmetic operations involve NULL string operands.
This check is a stylistic one used to verify that numeric variables are explicitly
initialized to zero rather than defaulting to NULL strings, which are treated as
zero in arithmetic operations.
Example: The expression x+10 will generate this warning when x is the NULL
string.
4 Enable warnings for arithmetic operations involving nonnumeric operands.
Example: The expression “mary” + “john” attempting to numerically add two
character strings will generate this warning.
8 Enable warnings for illegal or undefined arithmetic operations.
Example: Divide by zero.
Variable Initialization Warnings:
16 Enable warnings for variables that were not explicitly initialized.
This checks for variables that are used before being explicitly equated to a
value. Variables are initialized to the NULL string by default. BMC Software
recommends that you explicitly initialize all variables to a value (even the NULL
string) as a matter of good programming style.
Built-in Function Warnings:
32 Enable warnings for PSL Version 2.0 built-in functions.
This check allows you to suppress warning messages that were not
suppressible in PSL Version 2.0.
Example: A “file not found” for the cat() function will generate this warning.
PslDebug = 32 is the default if PslDebug is not specified to provide the
same default behavior as PSL Version 2.0.
64 Enable warnings for PSL Version 3.0 built-in functions.
This is a new error check of built-in functions that were not in PATROL®
Version 2.0. The errors detected include passing non-numeric arguments
when a numeric value is required, passing a bad argument, or passing the
wrong number of arguments to a printf() function.
128 (not used)
PslDebug Enable All Tracing:
256 Enable all PSL run-time tracing. Setting PslDebug = 256 is equivalent to
setting all tracing flag bits.



512 Enable function call tracing.
Function call tracing reports which functions are called but does not return
information about the arguments. Function call tracing traces both user-defined
and built-in functions.
1024 Enable function argument tracing.
Function argument tracing reports the arguments passed to all user-defined or
built-in functions. Function argument tracing requires that function call tracing
(PslDebug = 512) also be enabled; that is, PslDebug = 1536 for function
argument tracing.
2048 Enable function return value tracing.
Function return value tracing reports the value returned by calls to all
user-defined or built-in functions.
Variable Tracing:
4096 Enable variable assignment tracing.
Assignment tracing reports the variable name (if available) and the value
assigned to it.
8192 Enable errno tracing.
errno tracing reports any nonzero values stored in the PSL errno variable.
Lock Tracing:
16384 Enable PSL lock tracing
Lock tracing reports the interprocess actions that occur during lock() and
unlock() function processing, including the granting, denying, and releasing
of locks.
32768 (not used)
Table 6-1 PslDebug Error Checking Flag Bits (Part 3 of 3)



You set multiple flag bits by equating PslDebug to the sum of their
values. For example, PslDebug = 44 would enable the following flags:
• arithmetic operations involving nonnumeric operands (4)
• illegal or undefined arithmetic operations (8)
• PSL Version 2.0 built-in functions (32)
whose sum 4 + 8 + 32 is 44.