Empty Reports Detection using JCL - Endevor
search cancel

Empty Reports Detection using JCL - Endevor

book

Article ID: 440034

calendar_today

Updated On:

Products

Endevor

Issue/Introduction

You have a batch JCL that runs an Endevor report (such as Report 42) and need to drive subsequent steps in the JCL based on whether the report includes data.

Checking this is difficult because there is always output printed to ddname BSTRPTS (for example, the record extract counts), and the program C1BR1000 returns RC 0 to the JCL regardless of whether there is no data reported.

Environment

All supported releases of Endevor

Resolution

Check the contents of the SORTIN dataset. This file receives all the records from the extraction phase. If it contains zero records, this means that no reports will be produced

If you are producing a single report type, follow these steps in your JCL:

  1. Pre-create the SORTIN Dataset: Use a utility like IEBGENER to copy from a dummy input to a temporary dataset. This ensures the dataset has valid disk labels. If C1BR1000 extracts no data, it may not open the file, and subsequent steps will fail with open errors if the disk labels do not exist.
  2. Execute the Report: Run C1BR1000 using the pre-created temporary dataset for the SORTIN DD.
  3. Check for Records: Use IDCAMS to verify if any records were written to the file. The command is: PRINT INFILE(SORTIN_DD) OUTFILE(DUMMY_DD) COUNT(1) 
    If the SORTIN file is empty, IDCAMS returns RC 04. You can then use this return code to drive subsequent steps in your JCL logic to bypass the email step.

 

Additional Information

This method is effective for jobs producing a single report. If your job produces multiple reports, all extracted records are consolidated into the SORTIN DD, and you would need to count records by report type. The report type is a one-byte binary field at position 1 of the extract file.