If you are serious user of PL/I macro language or maintaining a program that uses of macros extensively to generate code, you may be required to debug at the level of the generated source, just as you may for EXEC CICS, EXEC DLI, or EXEC SQL. In these instances, use these techniques to step through every line of generated code, examining and changing variable values to understand what is happening in your program. This is particularly useful for discovering macro behavior that you do not understand or expect. By debugging at the generated code level, you can work out exactly what is happening.
Code that is actually present in the macro code is not part of PL/I source file. However, the macro code is available in the preprocessed file. To debug code that is actually present in the in the macro you must debug the preprocessed file.
You can create a preprocessed output file for the source file you are debugging and debug the output file. To do this, you must:
Use this procedure to create the output file for the source file you want to debug. Preprocessor output files have a .pp file extension.
If you do not specify an output file, the input filename is used. See the help topic Macro Preprocessor options for more information.
Once an output file is created. Pressing F10 to step into the code debugs the preprocessor file. The debugger shows the preprocessor file as the source being debugged. This output file contains the infused macro code.
For example, for a program file that contains a statement with macro calls:
x = x + 1; x = x + 2; $PGMSG(ADD10); $PGMSG(ADD20);
The output file includes the infused code for the macro calls.
x = x + 1; x = x + 2; DO; /* Tracing Block for: ADD10 */ put skip list (PreExecution: ADD10"); call ADD10(x); put skip list (Complete: ADD10"); put skip; END; DO; /* Tracing Block for: ADD20 */ put skip list (PreExecution: ADD20"); call ADD20(x); put skip list (Complete: ADD20"); put skip; END;
You can step into this code and debug it as you would with any other code.