This website is no longer being maintained.
Please see the latest information at our new site.



FORMagic/400 - Form/Data Alignment Issues



Occasionally, the complex interaction between OS/400 spooling, emulators, PCL-compatible printers, user applications, and forms causes a situation where forms and data are aligned differently when printed on various printers. Fortunately, this issue does not occur very often. When it does, however, so many factors are involved that it is virtually impossible to diagnose a specific cause and correct it directly.

FORMagic/400 is designed to print each form in a fixed location on the page, regardless of margins. In effect, forms are printed using the margin settings in place when the form was originally designed. It has been our experience that, when misalignment issues occur, the form actually prints in the intended location. The misalignment occurs because the data has moved, not the form. We believe the issue of varying alignment arises from obscure interactions among the settings used by spooling, the emulator, the user application, and the printer. Subtle interactions are always present, but they become far more obvious when electronic forms are introduced into the environment.

The procedure described below is intended to provide a circumvention when needed. It is fairly easy to implement, requires only that a few PCL commands be carefully employed, and represents the only reasonable solution we have seen.

The procedure uses PCL commands to set the upper left page margin (the page origin) to a fixed location and subsequently to adjust it in a manner so the data fits the form. It is intended to work on all printers, so you do not have to maintain separate programs or forms for the various alignments that occur. We cannot guarantee success in all environments, but we will support this procedure and amend it, if necessary and possible, to handle additional situations.



Considerations for Using the Print Data Relocation Commands

Several print data relocation techniques can be implemented. Using all of them together takes additional effort that is seldom necessary. Before getting into the details of the specific commands themselves, it is helpful to understand some of the higher level issues involved. This information will help you understand when specific techniques may or may not be required.

Obviously, some experimentation may be necessary to get just the right combination needed to resolve your alignment problem. It is often very desirable to experiment with a copy of your production program, perhaps even substantially shortened and simplified, before making permanent changes.

Dummy Pages: We have seen occasions where misalignment is different for page one and other pages. If all pages exhibit the same misalignment, a dummy page should not be required. When misalignment does occur differently for page one and other pages, first try using the relocation commands only. If that does not resolve the misalignment, there may be no choice except to insert a "dummy" page which precedes the "real" output pages. This page should have the form, print data relocation commands, and some dummy text, perhaps the words "This page intentionally left blank. Please discard it."

Every Page vs. First Page: Sometimes, you may have to insert the relocation commands on every page. Other times, insertion on the first page only, plus the dummy page if used, will suffice. If the architecture of your program permits it easily, use them on every page. If not, try them on the first page only. If that does not resolve the misalignment, you will have to do the extra work to place the commands on every page.

Form Merge Commands: The location where you place these command(s) on the page should not matter. However, these procedures show their placement on the same line as the relocation commands, which must always be the first thing on a page. Merge commands must always follow all relocation commands.

Horizontal Misalignment: We have almost never observed horizontal misalignment. We suggest that you employ the left margin alignment commands only in those very rare cases when you actually experience horizontal misalignment.

Vertical Misalignment: We do not observe vertical misalignment very often, but this is the specific problem these procedures were actually developed to address.



Print Data Relocation Commands

The complete print data relocation command is .&l#E.9.&a#L.&a0R!.*p+#Y.&f#y3X, where the periods represent the Escape character, the Exclamation Point represents a Carriage Return, and the #'s represent values you must supply.

Segregated into the individual component commands, we have:

        Characters:  .&l#E       .9.&a#L        .&a0R!         .*p+#Y         .&f#y3X
        ASCII Hex: 1B266C##45  1B391B2661##4C  1B266130520D  1B2A702B##59  1B2666##793358
        Purpose:   Top Margin   Left Margin      Row1,Col1     Vert Adj      Form Merge
        Usage:      Required     Optional        Required      Optional       Optional      


Programming for Print Data Relocation:

First, from the information provided above, determine which command components will be used. Each component must then be translated into appropriate AS/400 ASCII hex syntax as described in the FORMagic/400 User's Guide. You should already be somewhat familiar with this process since it is used with the form merge command. Only two steps are required to finalize each command:

Always use commands in the order presented above. Exclude any optional commands you don't need. After completing each individual command, string them all together with no spaces and place the result on row 1, starting in column 1. Do not place it anywhere else; it must be the first thing on the page! However, remember the merge command can go anywhere on the page as long as it follows all of the relocation commands.



Feedback

Please let us know when this procedure resolves an issue and when it does not. Given the unusual nature of this problem and the difficulty of identifying and finding all of the variables involved, feedback from everyone utilizing this procedure is critical toward helping us to optimize it for everyone.