You can try with the below codes:
The JCL will look like below:
//STEP001 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=pppnnn.SPOOL.LIST.ACTIVE.JOBS,
// DISP= (MOD, DELETE, DELETE), SPACE= (TRK, 0)
//STEP010 EXEC PGM=IKJEFT01 (this utility tools is to run REXX)
//SYSTSPRT DD SYSOUT=*
//OUTPUT DD DSN= pppnnn.SPOOL.LIST.ACTIVE.JOBS
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(5,10),RLSE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=80)
//SYSTSIN DD *
EXEC 'pppnnn.CA7.CNTL(REXX)' (location of the REXX)
MMCO* (Type of job I want to search)
‘pppnnn.SPOOL.LIST.ACTIVE.JOBS ' (output location)
/*
The REXX code will look like below:
This REXX will log into the SDSF panel with the credential of current user and will capture the jobs (the job particular has been passed from JCL), and will write the output in the output dataset as passed from JCL.
REXX Code
/**-------------------------------------------------------
"ALLOC F(XXOT) DS("DSN") SHR REUSE"
Drop out.
RC = ISFCALLS("ON")
isfowner='*'
Address SDSF "ISFEXEC I "Job"*"
If RC <> 0 Then Exit 20
jobname = word(isfcols,1)
out.1 = 'JOBNAME '
out.2 = '========'
Do ix = 1 to isfrows
jx=ix+2
out.jx = value(jobname"."ix)
End
"EXECIO * DISKW XXOT (FINIS STEM out."
"EXECIO 0 DISKW XXOT (FINIS"
"FREE F(XXOT)"
RC = ISFCALLS("OFF")
Say "Job list written to File"
Exit
/**---------------------------------------------------------------
Try with this... Best of luck!!!