The OPSCAWTO function is getting a return code 0 even when the ENFSNMPM task is down. It was expected to get a RC=4.
CA Common Services Reference:
Using the OPSCAWTO function to send SNMP traps out of the mainframe. This function requires the ENF started task to be active and also the spawned task ENFSNMPM.
The function OPSCAWTO returns a 4 when the ENF started task itself is inactive. There is no check to confirm if the ENFSNMPM is active.
A work around is to use the OPSTATUS function to check the status the ENFSNMP task before calling the OPSCAWTO function.