In CA Earl, how do you force SYSEARL to be opened and written to when no report is produced?

Document ID : KB000011258
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

In CA Earl, how do you force SYSEARL output to be opened and written to when no report is produced?

Answer:

When the SYSEARL data set is defined in the CA Earl execution JCL, the CA Earl report output is directed to the SYSEARL data set instead of to the SYSPRINT data set. However, if the CA Earl request results in zero records, no report is produced. When there is no report, the SYSEARL data set is not opened. This can cause problems for subsequent jobs or job steps that expect the SYSEARL data set to exist. How can you cause the SYSEARL data set to be opened and written to even though no report is produced?

Sample:

There is no option within CA Earl to force an open or write to SYSEARL when the request produces no records.

However, you can handle this in a JCL procedure application solution.
Two suggestions for the MVS environment follow:

  1. Add a step, prior to the Earl execution using IEBGENER to create the intended SYSEARL output file. Initialize or "prime" it with a single record, perhaps such as "There was no report produced by this Earl report."
    //INIT     EXEC PGM=IEBGENER//SYSIN    DD DUMMY//SYSPRINT DD SYSOUT=*//SYSUT2   DD DSN=sysearl.dataset,DISP=(NEW,CATLG,DELETE),...etc...//SYSUT1   DD *...some initialized record .../*
    Then, in the CA Earl step, point SYSEARL DD to the same data set:
    //EARL     EXEC PGM=EARL//STEPLIB  DD DISP=SHR,DSN=your.earl.cailib//SYSPRINT DD SYSOUT=*//SYSEARL  DD DSN=sysearl.dataset,DISP=SHR...//SYSIN    DD *...your Earl request that produces 0 records in the report .../*
    When there is no report produced, SYSEARL will not be opened and will contain the initialized record that you primed in the first step.

    When there is data, SYSEARL will contain the report output.

  2. Or, instead of priming the data set prior to the CA Earl step, consider adding an IEBGENER step after the Earl step to test if the SYSEARL data set was created. The IEBGENER will result in RC 12 when the file does not exist.
    //EARL     EXEC PGM=EARL//STEPLIB  DD DISP=SHR,DSN=your.earl.cailib//SYSPRINT DD SYSOUT=*//SYSEARL  DD DSN=sysearl.dataset,DISP=(NEW,CATLG,DELETE),...etc......//SYSIN    DD *...your Earl request .../*//ANY      EXEC PGM=IEBGENER,COND=EVEN//SYSPRINT DD SYSOUT=*//SYSIN    DD DUMMY//SYSUT1   DD DSN=sysearl.dataset,DISP=SHR//SYSUT2   DD DUMMY//*//NEXTSTEP EXEC PGM=next,COND=(0,NE,ANY)...
    Using this second example, step ANY will get RC 12 and NEXTSTEP will flush if the SYSEARL data set was not opened and therefore does not exist.