I am using the below code. This has worked great for me in the past. I have used this in many Rexx's.
$JOB = 'SYSPSMFP'
$RUN = OPSJESX("S","JOBNAME("$JOB")" "SYSTEM(SYSA)")
When I use it in a REQ rule, I found it is giving me false information. I am getting a '0' back for jobs that are actually running. I saw in manual that we can use OPSJESX in a REQ rule. I looked at the same job with this code in a Rexx and it gave me a '1' which was what I expected.
Is this a Request rule issue where this OPSJESX does not work?
Yes. The way the OPSJESX function is written, it can only be used in TOD rules; not in Request rules.
A return code of one(OPSRC = 1), in this case, indicates that it is in a non supported environment.
0 – Successful completion.
1 -- Error in OPS/MVS related processing
A documentation correction has been requested for the text below:
OPS/REXX Built-in Functions › OPSJESX Function
Note: You can use the OPSJESX function in OPS/REXX. OPSJESX can also be used in TOD and REQ AOF rules. The use within REQ rules is further restricted to within System State Manager (SSM). OPSJESX cannot be used in any other AOF rule type. The OPSJESX call operates for both JES2 and JES3.