Steps to add criteria for APPLREPORT
Running bi-monthly history maintenance job, using criteria:
RDRON GT TODAY LESS 2 WEEKS
It works fine for job reports as it will keep the last 2 weeks job information.
However, the above criteria won't keep any APPLREPORT data. You can only do an APPLREPORT back to the date that the last HISTFILE maintenance job ran.
How do you add Criteria for APPLREPORT data in HISTFILE maintenance job?
This is because RDRON is JOB criteria field and STARTDATE is APPLICATION criteria field. You will not be able to use only one REPORT in a bi-monthly maintenance job. If you want both JOB and APPL history data selected you have to use one for JOBs and one for APPLs.
You have to add another REPORT statement for applications to the bi-monthly HISTFILE maintenance job. This is so both job and application history records will be kept. You will need to use extend in the SYSIN data on the COPY statement. Also, you will use the same 'SELECT/REJECT' datasets for both reports. The second application report will add values to the output of the previous job report (using the EXTEND keyword on COPY statement).
Here is an example of how you can extend your HISTMNT step:
// IF (RC EQ 0) THEN //HISTMNT EXEC PGM=ESP,PARM='SUBSYS(ESPx)' //STEPLIB DD DSN=<hlq>.ESP.CD7YLOAD,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN DD * REPORT INPUT DATASET(<hlq>.ESP.HISTFILE) COPY SELECT + DATASET(<hlq>.ESP.HIST.SELECT) COPY REJECT + DATASET(<hlq>.ESP.HIST.REJECT) CRITERIA + RDRON GT TODAY LESS 2 WEEKS ENDR REPORT APPLREPORT INPUT DATASET(<hlq>.ESP.HISTFILE) COPY SELECT EXTEND + DATASET(<hlq>.ESP.HIST.SELECT) COPY REJECT EXTEND + DATASET(<hlq>.ESP.HIST.REJECT) CRITERIA + STARTDATE GT TODAY LESS 2 WEEKS ENDR /* // ENDIF