February 2007 Technical Tip Easytrieve: Redirecting report output

When creating a report with Easytrieve, the default action is to include the report in SYSPRINT with the program listing and error messages. It is often desireable to redirect the report to a separate DD. This article will demonstrate how this is done.

There are three steps in redirecting report output to a separate DD:

  • Add a DD statement to the JCL.
  • Add a FILE statement for that DD to the Easytrieve program. Be sure to include the PRINTER option. (See example below.)
  • Add the PRINTER option to the REPORT statement. This consists of the word PRINTER followed by the DD name.

The following program demonstrates how this is done. The program reads a file of my kids from //MYKIDS (using instream data), and writes a report containing girls only to //MYGIRLS:

//* JOBCARD
//STEP010 EXEC PGM=EZTPA00 
//MYKIDS   DD * 
CORA       14 F 
EMMA       08 F 
WILLIAM    16 M 
HANNAH     10 F 
//MYGIRLS  DD SYSOUT=*
//SYSPRINT DD SYSOUT=* 
//SYSIN    DD * 
FILE MYKIDS 
   NAME     1  10  A 
   AGE     12   2  N  0 
   GENDER  15   1  A 

FILE MYGIRLS PRINTER 

JOB INPUT MYKIDS 
   IF GENDER EQ 'F' 
      PRINT MYGIRLS 
   END-IF 

REPORT MYGIRLS LINESIZE 60 PRINTER MYGIRLS + 
      NOADJUST NODATE NOPAGE 
   TITLE 1 'BILL''S DAUGHTERS' 
   LINE NAME AGE 
Download file here.

The report is written to //MYGIRLS and is shown here with the generated carriage control characters. (The NOADJUST option on the REPORT statement causes the report to be written left-justified rather than centered.)

1BILL'S DAUGHTERS 
- 
   NAME      AGE 
0CORA         14 
 EMMA          8 
 HANNAH       10 

We hope you will consider Caliber Data Training when you are in need of high quality IT training including Easytrieve.


Go to the articles index. Written by Bill Qualls. Copyright © 2007 by Caliber Data Training 800.938.1222