How to run a batch job to search for messages in the OPSLOG and put them in a dataset?
OPS/MVS
I believe the OPSLOG function is what you are looking for. Reference to this function can be found in the link below:
OPSLOG Function Extended Format
You can run a REXX program that calls the OPSLOG function in many ways. As you mentioned the batch method, here is an example. The JCL below will run a REXX named LEOPDS1 from the SYSEXEC concatenation:
//REXX EXEC PGM=IKJEFT01,PARM='OI LEOPDS1'
//STEPLIB DD DISP=SHR,DSN=prefix.CCLXLOAD
//SYSEXEC DD DISP=SHR,DSN=prefix.REXX
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//LOGOUT DD DISP=(,CATLG,DELETE),
// UNIT=SYSDA,LRECL=256,RECFM=VB,SPACE=(TRK,(1,1)),
// DSN=prefix.OPSLOG.EXTRACT
//SYSIN DD DUMMY
//SYSTSIN DD DUMMY
A sample code for the REXX LEOPSD1 could be:
VAR = OPSLOG('EXTRACT DATE(05JAN22) TIME(08:00) ENDTIME(11:00)',
'MSGID(IEF*)',
'OUTCOLS(DATE,TIME) CMDRESP(REXX) PREFIX(LOGMSG)')
do i = 1 to logmsg.0
queue logmsg.i
end
ADDRESS TSO
'EXECIO * DISKW LOGOUT (FINIS'
See that the REXX above reads the OPSLOG from Jan, 5 time interval 8 to 11AM and searches for messages with messageid IEF*. The output will go to the LOGOUT dataset.
See the link above for other possible filters you can add to the OPSLOG execution.