fhg
Volume 7, Number 17 -- May 2, 2007

Overcome the Page Control Limitations of iSeries Access Printer Emulation Sessions

Published: May 2, 2007

by Michael Sansoterra

Over the years, iSeries Access virtual printer emulation sessions have been used to successfully print a variety of spool file reports from System i and AS/400 systems to a local PC printer. Regardless of the report's page attributes (page orientation, lines per inch, characters per inch, number of columns, etc.), the printer emulator will often successfully and automatically correct the output and automatically adjust the spool file's page settings to print successfully to a local printer. However, in other cases it seems like it takes quite a bit of tinkering to get various spool files to print correctly to a local printer.

Specifically, here are two common scenarios I encounter:

  1. After upgrading iSeries Access to a new level, the printer emulator no longer automatically adjusts the printer output to fit nicely on the PC printer's page as it once did. This has been especially true after a customer has upgraded to iSeries Access V5R3 where it seems the software has lost some ability to "auto fit" spool files to a PC printer. I'm assuming this is because IBM was in a losing fight to make the "auto-fit" capability to work with every kind of spool file and every kind of printer.
  2. The emulator has been set to force certain page characteristics such as only printing portrait reports with a 10 CPI font. For example, I spent about 30 minutes helping a customer configure an emulation session to print a specific software application's spool file in portrait. After lots of wasted time and paper we finally came up with a successful combination of settings to get everything on the page (although in the end the font the emulator chose still looked somewhat strange.) Worse, this specific printer emulator session was basically locked into printing a single type of report with specific page attributes!

Do these scenarios sound familiar? And what about those times when you finally get a printer session to work but don't get a good backup of the session's definition?! Attempting to reconfigure a session that once worked is often a frustrating exercise. (Over the years, I've attempted to help many customers re-create printer session definitions that were lost.)

When working with a PC laser printer, in many cases I believe the answer to these printer emulator dilemmas are:

  1. Stop relying on the printer emulator to correctly "auto fit" the page setup
  2. Stop forcing the printer emulator to print reports with one specific set of page attributes

If the emulator doesn't have to guess the page format, then we need no tinkering with the page definition--in most cases the default emulator characteristics will work so we don't need to worry about backing up the emulation session's definition or documenting an obscure combination of settings. Further, we don't need to lock a printer emulator into printing "landscape" only or "portrait" only printing as often occurs.

The answer to removing the guess work is to correctly define page attributes on the spool file itself so the emulator knows exactly how to format the page. A spool file gets its attributes from the printer file (or from a printer file override) so the printer file definition itself is where we need to focus our attention.

To illustrate the proposed solution, consider one common problem scenario:

  1. A report's printer file is defined with the default 132 character width.
  2. Only 80 characters or less are actually used in the printer output so the assumption is that the report should print portrait.
  3. However, since the emulator sees the need to print 132 characters wide it rotates the page to landscape.

In order to fix this problem, the printer file should be defined with the following characteristics:

PAGESIZE(66 80) CPI(10) LPI(6) PAGRTT(0)

The PAGESIZE parameter defines the page size at 66 lines per page and 80 characters across. The PAGRTT parameter defines the page rotation in 90 degree increments. The default page rotation is *AUTO which leaves some guesswork to the printer emulator as to how to best format the output. A page rotation of 0 will force a portrait print. A rotation of 90 will force landscape orientation. The CPI and LPI settings define the characters per inch and lines per inch. 10 CPI is the default. 6 LPI is also a default. For 11-inch length paper, 6 LPI will give us the default of 66 lines per page (11 inches per page time 6 LPI = 66 lines per page).

As already mentioned, when a spool file is generated it will inherit the page settings from the printer file's definition. When the spool file is sent to the emulator, these settings will instruct the emulator how to print the spool file without any guess work.

Understanding the relationship between the physical page width and the characters per inch (CPI) is an important key to hassle free printing. For letter-sized paper (8.5-inches by 11 inches), assuming default quarter-inch margins on the right and left, there is 8 inches of printable space across the page when printing portrait. At 10 CPI, we can fit 80 characters on the page (8 inches times 10 CPI = 80 characters.) If we increase the CPI to 12, 96 characters will fit.

Therefore, if you have a spool file that is 90 characters wide that you want to print portrait, you will need to increase the characters per inch setting to 12:

PAGESIZE(66 96) CPI(12) PAGRTT(0)

Many common printer files contain definitions with 132 characters across the page. Typically, these should print with the landscape orientation. Again, assuming letter size paper, with quarter-inch margins on each side we have 10 1/2 inches of printable space. At 10 CPI, we can fit 105 characters. At 12 CPI we can fit 126 characters--not quite enough. At 13.3 CPI (the next available CPI setting after 12), we can fit about 139 characters. (Note that printers vary in their default margin settings so this exact number may not fit.) Therefore, I usually set these printer files to use the following attributes:

PAGESIZE(51 132) OVRFLW(47) CPI(13.3) PAGRTT(90)

The page rotation (PAGRTT) option is set to 90 degrees for landscape and the increased CPI setting will allow a smaller font that is capable of getting all 132 characters across. Since the page is rotated, the paper is now only 8.5 inches in height and 66 lines will no longer fit. At 6 LPI, we can only fit 51 lines (8.5 inches per page times 6 LPI = 51 lines per page.) Recalling there is a margin, we will not get all of those lines on a page. The overflow line is arbitrary although it needs to be less than or equal to the page length. An overflow of 47 usually works but may need to be adjusted if there are detail or total sections that span multiple lines within a single record format in the printer file.

If you need more than 132 characters across a landscape page, simply increase the CPI setting to match the necessary page width:

PAGESIZE(51 165) CPI(15) OVRFLW(48) PAGRTT(90)

When exceeding 15 CPI, I've found that it also helps to increase the LPI from 6 LPI to 8 LPI so that the height of the font isn't out of proportion with its width:

PAGESIZE(68 198) CPI(18) LPI(8) OVRFLW(62) PAGRTT(90)

Please note that even though the page size is defined at 198 characters across (11 inches times 18 CPI = 198 characters) the printer margins will prevent all 198 characters from printing.

I've even printed a large number of columns on legal size paper (8.5 inches by 14 inches) using the following settings:

PAGESIZE(8.5 14 *UOM) LPI(12) CPI(20) PAGRTT(90) 

In this example, the page size is given in the unit of measure (inches) rather than the number of rows and columns.

Since default printer margins vary by manufacturer, we may not always consistently be able to fit the expected number of characters on the page. One manufacturer's default margins may be quarter-inch and another's may be half-inch (although with newer printers, large default margins are no longer the problem they once were!) But, if you have problems fitting everything due to margin restrictions, changing or overriding the printer file to type of *AFPDS should allow exact margins to be specified on the printer file definition:

DEVTYPE(*AFPDS) PAGESIZE(51 134) CPI(13.3) 
OVRFLW(47) PAGRTT(90) FRONTMGN(.2 .2)

Assuming the default unit of measure is inches, the FRONTMGN parameter above forces an upper left corner margin of 0.2 inches down and 0.2 inches across. However, an *AFPDS printer file can only be printed to an *AFP (advanced function printing) capable printer or to an ASCII printer device with the host print transform option set to *YES. To print AFP spool files to a virtual printer, configure the iSeries Access printer emulator to use the Host Print Transform option (menu option Communication --> Configure --> Setup).

How does one apply these printer file settings in a production environment? Setting these printer file attributes in an environment with homegrown software is as easy as specifying these parameters in the CRTPRTF (Create Printer File) command. However, purchased application software can be a special challenge. Here are a few ideas for how to proceed with canned software packages:

  1. Many vendors offer a printer file override facility which allows software administrators to define OVRPRTF (Override Printer File) commands for each printer file in the application. If your software has this option (MAPICS, for example, has an excellent facility for this), define the overrides with the appropriate attributes demonstrated in this tip.
  2. If you have source code, modify the source program to issue an OVRPRTF before generating a spool file.
  3. Duplicate the printer file to a user-object library in the application's library list, and then issue a CHGPRTF (Change Printer File) command against the printer file(s) to use the appropriate parameters. Whenever the software is upgraded, the printer files in this library may need to be replaced with newer versions and have the page setting changes applied again.

There is one other thing to consider. In certain cases, overriding the printer file with different page setup characteristics may be dependent on whether the user is printing to a local printer or an operator printing to, say, a line printer. In these cases, you may need to conditionally override a printer file based on user name, job name, etc. based on a presumed destination printer type.

Changing or overriding printer file parameters for specific page setup characteristics is a good way to get consistent printer output. Once printer files have been defined with appropriate attributes, you'll notice far fewer headaches with the printer emulator software!


Michael Sansoterra is a programmer/analyst for i3 Business Solutions, an IT services firm based in Grand Rapids, Michigan. Click here to contact Michael Sansoterra by e-mail.



                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
VISION SOLUTIONS

Vision Solutions Announces
iTera High Availability Version 5.0

The first new HA release from the newly merged
Vision and iTera companies

Features include:
Expanded autonomic capabilities for even
easier installation, expanded alerts, new role
swap testing and monitoring features
and expanded security.

Read more at
www.visionsolutions.com


Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

COMMON:  Join us at the Annual 2008 conference, March 30 - April 3, in Nashville, Tennessee
Seagull Software:  Web-enable your System i apps with LegaSuite GUI
VAULT400:  Securely archive data with Instant Back-Up & 24x7 Recovery


IT Jungle Store Top Book Picks

The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket Developers' Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
iSeries Express Web Implementer's Guide: List Price, $59.00
Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
WebFacing Application Design and Development Guide: List Price, $55.00
Can the AS/400 Survive IBM?: List Price, $49.00
The All-Everything Machine: List Price, $29.95
Chip Wars: List Price, $29.95

 

The Four Hundred
The i5 515 and 525: IBM's Competitive Analysis

More Details Emerge on IBM's Upcoming Power6 Server Launch

How to Build a Less Expensive i5 Developer Workstation

Mad Dog 21/21: Hearts and Minds

The Linux Beacon
Startup 3Leaf Systems Looks to Shake Up Server Virtualization

Sun's X64-Based Streaming Server Runs on Linux

More Details Emerge on IBM's Upcoming Power6 Server Launch

Mad Dog 21/21: Hearts and Minds

Four Hundred Stuff
MySQL Database Getting Closer Ties to the System i

BCD Bringing PHP Generation to WebSmart IDE

Quadrant Updates Forms Package, Content Management System

IBM Rolls Out LTO 4 Tape Drives and Libraries

Big Iron
Merrill Lynch Takes a Closer Look at IBM's Server Sales in Q1

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
April 28, 2007: Volume 9, Number 17

April 21, 2007: Volume 9, Number 16

April 14, 2007: Volume 9, Number 15

April 7, 2007: Volume 9, Number 14

March 31, 2007: Volume 9, Number 13

March 24, 2007: Volume 9, Number 12

The Windows Observer
Microsoft and SAP Talk Duet Roadmap, Tap HP for Appliance

No Patch Yet for DNS Flaw

Round Two: Intel's Fortunes Rise, and AMD's Fall

Intel Details Future 45 Nanometer Chip Plans from Beijing

The Unix Guardian
Computer Trade Group Alleges Unfair Trading Practices at Sun

HP Chases Data Warehousing Dollars with Tweaked NonStop Servers

Sun Grows Sales and Profits Despite Product Transitions

As I See It: Induced Labor

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

Help/Systems
Vision Solutions
WorksRight Software



TABLE OF CONTENTS
Monitor for Specific Messages in RPG

Overcome the Page Control Limitations of iSeries Access Printer Emulation Sessions

Admin Alert: Dealing with i5 Critical Storage Errors, Part 2

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
Specific Record Range (CL)

Can a program be written to pull data from the network?

Adopted Authority....

PASE application terminates when session is closed

User profile for webserver instances





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement