To route log messages to a particular destination, the JCL must contain DD cards STDOUT and STDERR in the DD statements which mean route stdout and stderr to the specified DD location.
//STDOUT DD PATH='/u/ctgusr/ctglogs/ctg1_stdout.log',
// PATHOPTS=(OCREAT,OAPPEND,OWRONLY),
// PATHMODE=(SIRUSR,SIWUSR,SIRGRP,SIROTH)
//STDERR DD PATH='/u/ctgusr/ctglogs/ctg1_stdoerrlog',
// PATHOPTS=(OCREAT,OAPPEND,OWRONLY),
// PATHMODE=(SIRUSR,SIWUSR,SIRGRP,SIROTH)
If the STDOUT DD statement is omitted, a JES log with the name 'SYS00001' will be dynamically allocated the first time that data is written to the stdout destination.
If the STDERR DD statement is omitted, a JES log will be dynamically allocated. The name is dependent upon the MSGFILE Language Environment® runtime option. If allowed to default the name will be 'SYSOUT'.