To find the errors occurred in the REXEC session, you can create REXEC server spooled job logs.
The REXEC server automatically writes a server job log to a spooled file when it ends with an error.
To have a spooled job log produced at the end of each REXEC session and each time the REXEC server ends, use the CHGJOBD command as follows:
CHGJOBD JOBD(QTCP/QTMXRXCS) LOG(4 00 *SECLVL)
To obtain a spooled job log only when a server ends, use the CHGJOBD command as follows:
CHGJOBD JOBD(QTCP/QTMXRXCS) LOG(4 00 *NOLIST)