Why does message not sent to the activity log with &WRITE LOG=YES?

Document ID : KB000015718
Last Modified Date : 14/02/2018
Show Technical Document Details

All messages sent to the activity (online) log are going through the logproc ($LOPROC).

As it is created as an OML procedure, it is not possible to alter for custom settings. A logproc exit is provided for this purpose and may be used for messages monitoring from the activity log. It  can be set through the 'Log Exit Name' field in /PARM $NM LOGFILES group.



Why does message not sent to the activity log with &WRITE LOG=YES?



&WRITE is used to generate a message from a NCL procedure. With LOG=YES parm, it is possible to send the message to the log from any environment except from the LOGP.

For this reason, &WRITE LOG=YES will not send any message if it is executed from a logproc exit running in LOGP.

The workaround consists of submitting another NCL procedure to a background environment from there.



Instead of &WRITE LOG=YES in the logproc exit, use the following statement:


ncl_proc  includes  &WRITE LOG=YES


Additional Information:

The logproc exit should be used with care in any environment receiving a lot of messages in the log.

Each of them causes the logproc exit to be executed and may impact the performance of the region.