The changes in 7.1 make life a whole lot easier!
Historically, converting spooled files on IBM i has been a bit of an arduous task, but in recent releases, it's become much easier. In April 2010, I wrote an article about how to convert AFP to PDF using native commands included in IBM i 6.1 at no charge. With the release of IBM i 7.1, we're fortunate that IBM has expanded on these abilities by adding a couple of neat features.
In IBM i 6.1, IBM added support to allow you to natively generate a PDF file from your application though the use of workstation customizing objects. In order to do this, you need to define or override a printer file with a device type of *AFPDS to use a workstation customizing object. You can use *PDF for the WSCST parameter, or you can specify a workstation customizing object with an attribute of CTXFORM. In any event, you also must identify the stream file where the resulting PDF output is created. The application can now generate a PDF file rather than the AFP spooled file. This support requires the IBM Transform Services for i and PASE licensed programs to be installed. Both of those licensed programs come with your OS at no charge.
What's New in 7.1?
In IBM i 7.1, we now have the ability to convert spooled files natively to PDF by using Systems Director Navigator for i. This feature is not supported in the System i Navigator client unless you have Infoprint Server installed. I would assume this is just IBM intentionally moving more features away from the heavy Navigator client toward the Web interface.
If you select a spooled file, you can click the menu option View As PDF. This does the native conversion and displays the PDF on the screen.
You can also use the "Export as > PDF > to client file system" option, but don't be fooled by the other options listed; they don't work unless you have Infoprint Server installed. The first option in the list, Export as > PDF > to client file system is the only one offering native support for conversion. You can export your spooled file to a PDF in any directory you have authority to on your IFS, a shared drive, or a directory on your local computer. You can't get much easier than this, and many products out there offer this same feature for a cost that you can now eliminate.
Couldn't IBM Just Add Native Support to CPYSPLF?
Well...yes!
IBM i 7.1 PTF SI43471 augments the CPYSPLF command to now support copying spooled files into the Integrated File System (IFS)! IBM not only added new parameters to choose where the copied file is to be stored in the IFS, but also enabled support for the ability to choose a workstation customizing object (WSCST). By choosing an IBM-supplied WSCST, you can convert your spooled file to PDF and even TIFF (using either customizing objects QWPTIFFPB or QWPTIFFG4 ) or GIF (using QWPGIF) files on the fly. Unfortunately, there is no support yet for this PTF on IBM i 6.1, which is yet another reason for moving on up to 7.1 in the near future.
You need to install licensed programs IBM Transform Services for i and Transforms – AFP to PDF Transform for this feature to work.
To take advantage of this new function, specify the new *TOSTMF special value on the CPYSPLF TOFILE parameter. The spooled file will be converted based on the workstation customizing object specified in the Workstation customizing object (WSCST) parameter and the output placed in the stream file specified in the To stream file (TOSTMF) parameter. You must ensure the path exists on the IFS where you want to have the spooled file generate beforehand. It, of course, will not create directories as part of the conversion.
Here are the new parameters included with the CPYSPLF command, taken from the PTF cover letter:
To stream file (TOSTMF)
Specifies the stream file where the output data is to be written. All directories in the path name must exist. New directories are not created. This parameter must specify a value other than *NONE if the To data base file (TOFILE) parameter is *TOSTMF.
*NONE
The output is written to a user-defined physical file. This value is only valid if the To data base file (TOFILE) parameter specifies a user-defined physical database file.
path-name
Specify the path name for the stream file where the output data is to be written. This value is only valid if the To data base file (TOFILE) parameter specifies *TOSTMF.
Note: If the stream file exists, the CCSID associated with the stream file will not be changed.
Workstation customizing object (WSCST)
Specifies the workstation customizing object to use to transform the spooled file output to final form before writing it to a stream file. If the To data base file (TOFILE) parameter specifies a physical database file, the WSCST parameter is ignored. In order to convert a spooled file using the (WSCST) parameter, the device type (DEVTYPE) of the spooled file must be *SCS or *AFPDS.
*NONE
Specifies that no workstation customizing object is to be used.
If the To data base file (TOFILE) parameter specifies *TOSTMF and the device type of the spooled file is *AFPDS or *USERASCII, the spooled file data will be copied directly to the stream file.
If the stream file does not exist, the associated CCSID of the stream file will be set to 65535.
For other types of spooled files, the spooled file data will be copied to the stream file using the Control character (CTLCHAR) parameter to format the data. Lines will be ended with carriage return and line feed controls to indicate record
boundaries. If the stream file does not exist, a CCSID obtained from the spooled file attributes will be associated with the stream file.
If the spooled file has a CHRID attribute other than *DEVD, the CHRID attribute will be used to select the CCSID to be associated with the stream file. If the spooled file has a CHRID attribute of *DEVD, the CCSID of the job which created
the spooled file will be used.
*PDF
The output is transformed to Portable Document Format (PDF) before it is written into a stream file. If the stream file does not exist, the CCSID associated with the stream file will be set to 65535.
Qualifier 1: Workstation customizing object name
Specify the name of the customizing object. When a named customizing object is used and the stream file does not exist, the CCSID associated with the stream file will be set to 65535.
Qualifier 2: Library
*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the job is used to locate the customizing object. If no current library entry exists in the library list, QGPL is used.
name
Specify the name of the library where the customizing object is located.
Stream file option (STMFOPT)
Specifies whether the copy operation replaces or fails to copy the records to the stream file if a stream file with the specified name already exists. If the stream file does not exist, it is created.
*NONE
No records are copied and the operation will fail.
*REPLACE
The records replace the existing stream file records.
So Easy!
With the new CPYSPLF command, you can easily adjust a CL program in order to take your spooled file to the IFS as an image or PDF. The practical applications for this are numerous. Imagine if you wanted to automatically email your customers an invoice as a PDF or TIFF file without doing a whole lot of work. Or dump your old payroll spooled files onto a file server as PDFs? IBM has made conversion tasks a heck of a lot easier.
as/400, os/400, iseries, system i, i5/os, ibm i, power systems, 6.1, 7.1, V7, V6R1
LATEST COMMENTS
MC Press Online