Sign in

docs RPG Guide

Specifying PRINTER Files

Specifying PRINTER Files

To indicate that you want your program to access printer files, specify PRINTER as the device name for the file in a File Description specification. Each file must have a unique file name. A maximum of eight printer files is allowed per program.

PRINTER files can be either externally-described or program-described. Overflow indicators OA-OG and OV, fetch overflow, space/skip entries, and the PRTCTL keyword are not allowed for an externally-described PRINTER file. See the IBM Rational® Development Studio for i: ILE RPG Reference for the valid output specification entries for an externally-described file.

For an externally-described PRINTER file, you can specify the DDS keyword INDARA. If you try to use this keyword for a program-described PRINTER file, you get a run-time error.

You can use the CL command CRTPRTF (Create Print File) to create a printer file, or you can use the IBM®-supplied file names.

For information on the CRTPRTF command, see the CL and APIs section of the Programming category in IBM Documentation at this web site: https://www.ibm.com/docs/i.

For information on IBM-supplied file names and the DDS for externally-described printer files, refer to the Db2 for i section of the Database and File Systems category in IBM Documentation at this web site: https://www.ibm.com/docs/i.

The file operation codes that are valid for a PRINTER file are WRITE, OPEN, CLOSE, and FEOD. For a complete description of these operation codes, see the IBM Rational Development Studio for i: ILE RPG Reference.