Use the following record functions to process printer files:
Example:
The following example uses First Character Forms Control in a program described printer file. Employees' names and serial numbers are read from a physical file and written to the printer file.
CRTPRTF FILE(MYLIB/T1520FCP) CTLCHAR(*FCFC)
CHLVAL((1 (13)))
CRTPF FILE(MYLIB/T1520FCI) RCDLEN(30)
Jim Roberts 1234567890
Karen Smith 2314563567
John Doe 5646357324
CRTBNDC PGM(MYLIB/T1520FCF) SRCFILE(QCPPLE/QACSRC)
Figure 154. T1520FCF -- ILE C Source to Use First Character Forms Control
|
The fopen() function opens the printer stream file T1520FCP using record at a time processing. The fopen() function also opens the physical file T1520FCI for record at a time processing. The strncpy() function copies the records into the print buffer. The fwrite() function prints out the employee records.
CALL PGM(MYLIB/T1520FCF)
The output file is as follows:
+--------------------------------------------------------------------------------+ | | | EMPLOYEE INFORMATION | | -------------------- | | NAME SERIAL NUMBER | | ---- ------------- | | Jim Roberts 1234567890 | | Karen Smith 2314563567 | | John Doe 5646357324 | +--------------------------------------------------------------------------------+
The printed output file is as follows:
|
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.