Overview

This is a collection of tips, tricks, and late breaking workarounds that we have discovered or been told about. If you have a tip, trick or fix that belongs here, let us know (Contact).

Nuggets

J D Edwards   PDF Spooled Files J D Edwards can generate *USERASCII spooled files containing PDF. You can successfully convert these with Spool-a-Matic or send these with SpoolMail by specifying TRANSFORM(*NONE) and an extension of .PDF.
 
Printing AFP on  IBM i IBM i  provides powerful printing capabilities collectively known as AFP (Advanced Function Presentation). The base operating system gives you everything you need to take advantage them unless you have IPDS printers in which case you also need PSF/400. For example, you can create overlays (electronic forms) to replace preprinted forms and print invoices on plain paper on your laser printers.
 
Bible The single best source that we have found for information on all aspects of IBM i printing is the Redbook SG24-4389 Printing V (and its replacement SG24-6250 Printing VI). The books are available for download in the PDF format at www.redbooks.ibm.com.

The Redbook supplements the standard reference documents on printing by providing more specific "how to" information, such as diagrams, programming samples, and working examples. We find that it pulls together the information from other manuals and fits the pieces together in an understandable way.

 
Creating Overlays
and Page Segments  
InfoPrint's (formerly IBM's® ) AFP Printer Driver is a very useful piece of software that allows you to create IBM i overlays and page segments by "printing" from any PC based application. Best of all, it is free and available for download at www.infoprintsolutionscompany.com, search on "AFP Printer Driver" or try this Google search. The driver was last spotted here. Also, the AFP AS/400 Programming Sampler which contains useful tools for compiling IBM i overlays and page segments. The sampler.savf was last spotted at ftp://ftp.software.ibm.com/printers/products/as400

Additional information is available from the IBM Software Knowledge Base Document Number 5184341, Creating AFP Resources Using the IBM AFP Printer Drivers.

Our experience shows that you get the best results using a smaller is better approach to creating overlays and page segments. Trim as much as possible and position instead of creating a page size overlay or page segment. Use the lowest resolution, color depth, etc. that gives acceptable results.

 
*LINE and *AFPDSLINE Data Our spooled file conversions do not process spooled files with printer device type *LINE or *AFPDSLINE. However IBM i allows you to convert these to pure *AFPDS data which can be processed (most conversions). There are two methods for accomplishing this: 1) The printer file's CVTLINDTA() parameter while creating the spooled file, or 2) respooling an existing *LINE or *AFPDSLINE spooled file using CRTAFPDTA/PRTAFPDTA commands. See RedBook SG24-6250 Printing VI for details and examples.
 
Product Command Defaults As with any CL command, you can change the default values of the commands found in our products. You do this using the IBM i Change Command Default (CHGCMDDFT) command.

But before you do, there are some gotchas you should be aware of. You WILL lose the change each time a new release of the product is installed, and you COULD lose the change when PTFs are applied to the product. You must then reapply the change.

As an example, to change the default transform on SpoolMail's SNDSPLMAIL command from *TXT to *PDFA4, run the following:

CHGCMDDFT CMD(SNDSPLMAIL) NEWDFT('TRANSFORM(*PDFA4)')

 
  CL Trick Many of our commands accept a variable number of values for a given parameter. For example, the Send Spool Mail (SNDSPLMAIL) command accepts up to 300 email addresses on the recipient parameter. When writing CL programs, the problem of how to code for a variable number of email addresses without coding the SNDSPLMAIL command multiple times (once for each address count) arises. The solution is a little known CL trick for coding "no value" in a variable. "No value" is represented in CL by '*N'. Consider the following program fragment:

PGM
DCL VAR(&ADD1) TYPE(*CHAR) LEN(128) VALUE('*N')
DCL VAR(&ADD2) TYPE(*CHAR) LEN(128) VALUE('*N')
DCL VAR(&ADD3) TYPE(*CHAR) LEN(128) VALUE('*N')

CHGVAR VAR(&ADD1) VALUE(NOBODY@GUMBO.COM)

SNDSPLMAIL FILE(QPDSPLIB) TRANSFORM(*TXT) +
TOSMTPNAME((&ADD1) (&ADD2) (&ADD3))

ENDPGM

Since &ADD2 and &ADD3 contain '*N' they are treated as if they were not specified on the command and the email is sent to only one address.