Only a few changes are needed to the sequence of requests and commands to produce a report. Use an editor to add the following commands to the file:
- Insert an EXPORT command after the LOGON command to divert the report results to a file called report.out.
For mainframe-attached systems, enter the following commands:
.tso allocate ddname(repfile) dsname(report.out) shr .export report ddname=repfile
For workstation-attached systems, enter the following command:
.export report file=report.out
- After the EXPORT command, enter the following RTITLE command to place a report title at the top of each page of the report, along with the date and page number.
.set rtitle 'Department Information'
- To enable (activate) page formatting commands, add a FORMAT command before and after the SQL EXECUTE command as follows:
.set format on execute deptdisplay; .set format off
- Use the RESET option of the EXPORT command to end diversion of the report results:
.export reset
Example – Mainframe-Attached
This is an example of a file on a mainframe-attached system:
.logon tdpid/userid, password .tso allocate ddname(repfile) dsname(report.out) shr .export report ddname=repfile .set rtitle 'Department information' .set format on execute deptdisplay; .set format off .export reset .logoff
Example – Workstation-Attached
This is an example of a file on a workstation-attached system:
.logon tdpid/userid, password .export report file=report.out .set rtitle 'Department Information' .set format on execute deptdisplay; .set format off .export reset .logoff .exit