Writing messages to a job log file

You can use the _BPXK_JOBLOG environment variable to specify that messages be written to a job log. Set it to one of these values:
  • nn specifies that job log messages are to be written to open file descriptor nn.
  • NONE specifies that job log messages are not to be written. This is the default.
  • STDERR specifies that messages are to be written to the standard error file descriptor, 2.

Tip: You can change the file that is used to capture messages by calling the oe_env_np (BPX1ENV) service and specifying _BPXK_JOBLOG with a different file descriptor. Message capturing is turned off if the specified file descriptor is marked for close on a fork or exec. Message capturing is process-related. All threads under a given process share the same job log file, and any thread under that process can initiate message capturing.

Multiple processes in a single address space can each have different files active as the JOBLOG file. Some or all of them can share the same file, and some processes can have message capturing active while others do not.

Guideline: When the file that is used as a job log is shared by several processes (for example, by a parent and child), the file should be opened for append. If the file is not opened, unpredictable results might occur. Only files that can be represented by file descriptors can be used as job log files; MVS™ data sets are not supported.

Message capturing is propagated on a fork or spawn.
  • If a file descriptor was specified, the physical file must be the same before message capturing can continue in the forked or spawned process.
  • If STDERR was specified, the file descriptor can be remapped to a different physical file. You can override message capturing on exec or spawn by specifying the _BPXK_JOBLOG environment variable as a parameter to the exec or spawn. Message capturing only works in forked (BPXAS) address spaces.

Messages that would normally go to the JESYSMSG data set are captured, but messages that go to JESMSGLG are not captured.