You can specify that most CL commands run in a CL procedure be written (logged) to the job log.
This can be done by specifying one of the following values on the LOG parameter on the Create Control Language Module (CRTCLMOD) command or the Create Bound Control Language Program (CRTBNDCL) command when the procedure is compiled:
Because these values are part of the Create Control Language Module (CRTCLMOD) and the Create Bound Control Language Program (CRTBNDCL) commands, you must recompile the module or program to change them.
When you specify logging, you should use the Remove Message (RMVMSG) command with care in order not to remove any logged commands from the job log. If you specify CLEAR(*ALL) on the RMVMSG command, any commands logged prior to running the RMVMSG command do not appear in the job log. This affects only the CL procedure containing the RMVMSG command and does not affect any logged commands for the preceding or following recursion levels.
Not all commands are logged to the job log. Following is a list of commands that are not logged:
CALLPRC | CALLSUBR | CHGVAR |
DCL | DCLF | DCLPRCOPT |
DO | DOFOR | DOUNTIL |
DOWHILE | ELSE | ENDDO |
ENDPGM | ENDSELECT | ENDSUBR |
GOTO | IF | ITERATE |
LEAVE | MONMSG | OTHERWISE |
PGM | RTNSUBR | SELECT |
SUBR | WHEN |
If the logging option is on, logging messages are sent to the CL procedure's message queue. If the CL procedure is running interactively, and the message level on the job's LOG parameter is set to 4, you can press F10 (Display detail messages) to view the logging of all commands. You can print the log if the message level is 4 and you specify *PRINT when you sign off.
The log includes the time, program and procedure names, message texts, and command names. Command names are qualified as they are on the original source statement. Command parameters are also logged; if the parameter information is a CL variable, the contents of the variable are printed (except for the RTNVAL parameter).
Logging of commands affects performance.