Newsletters Subscriptions Media Kit About Us Contact Search Home

mgo
OS/400 Edition
Volume 3, Number 46 -- July 18, 2003

Extract Reports from Disk Files


Hey, Ted:

I have a file that was created on an OS/390 mainframe and saved as a dataset (disk file). The file is a copy of a printed report, complete with carriage control characters. I downloaded the file to my iSeries and saved it as a physical file. How can I convert the file to a spool file?

--Joseph


OS/400 can handle those printer control characters. Run these commands to solve your problem.

OVRPRTF FILE(QSYSPRT) CTLCHAR(*FCFC)
CPYF yourfile TOFILE(QSYSPRT)

The term *FCFC stands for "first-character forms control." The system interprets the first character of each line according to the following table.

Character   Name      Meaning
=========   =======   ==================================
1           one       Skip to new page before printing
            space     Single space before printing
0           zero      Double space before printing
-           hyphen    Triple space before printing
+           plus      Do not space (causes overprinting)

These are the most common FCFC control characters. In addition to these characters, characters 2 through 9 and A through C indicate a skip to the lines associated with channel numbers 2 through 12. You are not likely to run into those control characters, but if you do, you should be able to accommodate them by placing the proper values in the CHLVAL parameter of the Override with Printer File (OVRPRTF) command.

The Copy File (CPYF) command creates a new spool file from the data in the disk file. Because the OVRPRTF command is in effect, the first character of each line is interpreted as a forms control character.

You can also use this technique to rebuild a report with different characteristics. For example, suppose you have a spool file that was created at 10 characters per inch. The following sequence of commands creates a new spooled file at 15 characters per inch.

CRTPF FILE(QTEMP/SPLFDATA) RCDLEN(133)
CPYSPLF FILE(mysplf) TOFILE(QTEMP/SPLFDATA) +
           CTLCHAR(*FCFC)
OVRPRTF FILE(QSYSPRT) CPI(15) CTLCHAR(*FCFC)
CPYF FROMFILE(QTEMP/SPLFDATA) TOFILE(QSYSPRT)

Notice that I created the disk file with a record length of 133. This allows for one control character and 132 characters of data. If your spool file has a record length other than 132, adjust accordingly. The Copy Spooled File (CPYSPLF) command places the report data in the physical file, with a forms control character in the first position of each record, like the file you received from the mainframe. The OVRPRTF command changes the print density to 15 characters per inch, causing the CPYF command to build a new spool file at 15 CPI.

--Ted


Related Articles

"Page 1 of X"

"Reading Spool Files in RPG"


Sponsored By
AFFIRMATIVE COMPUTER

Affirmative Computer Products has the most complete thin client product line optimized for IBM iSeries and zSeries users as well as older AS/400 and S/390 models.

Affirmative provides superior products and services for users of IBM-hosted networks with access to Windows, Unix, Linux and Web-enabled applications.

For more information on our wide range of thin client and terminal emulation solutions, visit www.affirmative.net.


THIS ISSUE
SPONSORED BY:

WorksRight Software
Affirmative Computer


BACK ISSUES

TABLE OF
CONTENTS

Use Workstation Customizing Objects to Control Printing

Extract Reports from Disk Files

Reader Feedback and Insights: More About Strings


Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris
Shannon O'Donnell

Managing Editor
Shannon Pastore

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.