IBM AS/400 Frozen Dessert Maker User Manual


 
Accessing Printer Devices
Accessing Printer Devices
PRINTER files of ILE RPG programs associate with the printer files on the AS/400
system:
Printer files allow you to print output files. This chapter provides information on how
to specify and use printer files in ILE RPG programs.
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
ILE
RPG for AS/400 Reference
for the valid output specification entries for an
externally-described file. See the
DDS Reference
for information about the DDS for
externally-described printer files.
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
(see the
CL Reference (Abridged)
for further information on the CRTPRTF
command); or you can also use the IBM-supplied file names. See the
Data Man-
agement
manual for more information on these file names.
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
ILE RPG for AS/400 Reference
.
Handling Page Overflow
An important consideration when you use a PRINTER file is page overflow. For an
externally-described PRINTER file, you are responsible for handling page overflow.
Do one of the following:
Specify an indicator, *IN01 through *IN99, as the overflow indicator using the
keyword OFLIND(
overflow indicator
) in the Keywords field of the file description
specifications.
Check the printer device feedback section of the INFDS for line number and
page overflow. Refer to the
ILE RPG for AS/400 Reference
for more informa-
tion.
Count the number of output lines per page.
Check for a file exception/error by specifying an indicator in positions 73 and 74
of the calculation specifications that specify the output operation, or by speci-
fying an INFSR that can handle the error. The INFDS has detailed information
on the file exception/error. See Chapter 12, “Handling Exceptions” on
page 217 for further information on exception and error handling.
316 ILE RPG for AS/400 Programmer's Guide