Variable substitution
You can use variable substitution to enter changing values into the text messages supplied in diagnostic records in both C and assembler programs. Configure the variables in:
- COPY member CZAPI1DG, if using an assembly language program
- CZAPI1DG.h, if using a C language program
Both contain a list of the variables, with comments detailing the basic substitution specification for each. The maximum size of the message text after variable substitution is 250 characters.
Example of variable substitution
Define a message as:
PROGRAM1 completed; %1$d records passed
In this example for an assembler program, specify the record count, in binary, in the field CZ1DiagWord1. The message prints as shown:
PROGRAM1 completed; 2387 records passed
Using variable substitution
Use minor event type:
- CZ1DiagMinSubstA, if you want to use variable substitution
- CZ1DiagMinSubstNo, if you do not want to use variable substitution
Substituting a variable into a message
Variable substitution is particularly helpful for reentrant assembler programs. If you have experience programming in C, this will be familiar to you. To substitute a variable into a message, use the specification:
%n$w.pt
The characters are defined as follows:
Character | Definition |
---|---|
% | Required substitution indicator |
n | Variable number |
$ | Required delimiter |
w | (Optional) Width |
.p | (Optional) Precision The maximum number of significant digits that can result from an operation. Note the preceding period required by this option. |
t | Required type code (described below) |
Related topic