CL Programming

Logging CL Procedure Commands

You can specify that most CL commands run in a CL procedure be written (logged) to the job log by specifying one of the following values on the LOG parameter on the CRTCLMOD or CRTBNDCL command when the procedure is compiled:

*JOB
This default value indicates that logging is to occur when the job's logging option is on. The option is initially set for no logging, but it can be changed by the LOGCLPGM parameter on the CHGJOB command. Therefore, if you create the module or program with this value, you can alter the logging option for each job or several times within a job.

*YES
This value indicates that logging is to occur each time the CL procedure is run. It cannot be changed by the CHGJOB command.

*NO
This value indicates that no logging is to occur. It cannot be changed by the CHGJOB command.

Because these values are part of the CRTCLMOD and 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:

CHGVAR DO GOTO
DCL ELSE IF
DCLF ENDDO MONMSG
PGM ENDPGM CALLPRC

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.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]