This module covers detailed explanation of creating externally described printer files in RPGLE programs. Also Covers some examples program described printer files.
Printer Files:
Printer files describe how system formats the data as it is passed from the program to the printer. The data to be printed will be created as a spool file and is stored in the output queue, which will eventually get printed.
Types of Printer Files:
- Externally described printer files
- Program described printer files
Externally described Printer Files:
The Externally described Printer Files can be designed using Report Layout Utility(RLU). These files can be designed using Rational Developer for I also or the DDS also can be coded directly. RLU converts the report design into corresponding DDS and stores them as a source member under a source physical file. The source type of the converted DDS will be PRTF. These files will be declared in the RPGLE program with device as PRINTER.
Advantage of using externally described printer files is the maintenance is easier as the structure is saved external to the program.
Creation of the externally-described printer file is covered as part of Application Development Tool Set module. Please refer to that course for detailed explanation.
Program described Printer Files:
The record format and the fields to be printed are described within the program in the output specification. We can create our own blank printer files using CRTPRTF command or use the IBM supplied printer files. QSYSPRT, QPRINT are some system supplied printer files.
Three ways of creating spool files:
- Using indicators to control the write of H/D/T records in the O-specification
- Using Except name and type as E in O-specification and using EXCEPT opcode to write the record formats (EXCEPT name) defined in the O-specification
- Using externally described printer files
Example (Program Described Printer files- Using EXCEPT)
Example (Externally Described Printer files)
Printer file layout:
Program Code: