Simple. Effective. Affordable. Your trusted IBM Midrange Partner for over 10 years...

Chapter 13 - Merging Spooled Files with SPLTOOL

With SPLTOOL you are able to merge two or more *SCS spooled files into text, HTML, PDF, or the RTF formats. Merging can be performed one of two ways. Each way is described below as well some important notes to remember when merging spooled files.

Merging Spooled Files using the "Batch" Commands

The first method used to merge spooled files into one document is using the SPLTOOL "Batch" comands. These commands consist of the following:

  • Spooled File to Stream File Batch (SPL2STMFB)
  • Spooled File to Folder Batch (SPL2FLRB)
  • Spooled File to Email Batch (SPL2EMAILB)
  • Spooled file to FTP Batch (SPL2FTPB)

The Batch commands will allow you to select and process one or more spooled files in one command. By default, each spooled file processed will be placed into it's own seperate file. Using the MERGE(*YES) parameter on any of these commands will instead copy all of the data into one resulting document.

If you wish to specifically name the file that is created, then you should also specify the Only File Name (ONLYF) parameter as *YES, and then specify a file name on the File Name (FNAME) paramenter. If this is not done, then file will be given the name of the last file processed in the group.

An example of using the command to copy all spooled files in output queue REPORTS with a user data containing the value COPY to a PDF document named "/myfiles/reports/allreports.pdf" is as follows:

SPL2STMFB OUTQ(REPORTS) FILE(*ALL) USER(*ALL) JOB(*ALL) JOBNUM(*ALL) SPLNUM(*ALL) USRD(COPY) FRMT(*ALL) DIR('/myfiles/reports') EXT(PDF) ONLYF(*YES) FNAME (allreports) MERGE(*YES)

 


Merging Spooled Files Manually

It is also possible to merge two or more spooled files into one document manually using the normal single file processing comands. These commands are as follows:

  • Spooled File to Stream File (SPL2STMF)
  • Spooled File to Folder (SPL2FLR)
  • Spooled File to Email (SPL2EMAIL)
  • Spooled File to FTP (SPL2FTP)

In order to merge spooled files manually in this fasion you must use the MERGE parameter specifying a specific value for the first, all other spooled files, and the last spooled fie in the group. All commands must be run sequentially in the same job and the order that the spooled files are merged will be the order that the spooled files are processed.

For the first spooled file, you must specify MERGE(*FIRST) on the command. For all other spooled files you must specify MERGE(*YES). Then, one final time you must call the command with the same information as the last spooled file and specify MERGE(*LAST). This will trigger the command to merge all spooled files in the group and create the resulting document.

The following example will merge three spooled files into one PDF document named "/myfiles/reports/allreports.pdf":

SPL2STMF FILE(QPJOBLOG) JOB(290242/BVSTONE/QPADEV0014) SPLNBR(2) FROM(*FIRST) TO(*LAST) TOSTMF(allreports.pdf) DIR('/myfiles/reports') MERGE(*FIRST)

SPL2STMF FILE(REPORT2) JOB(290430/BVSTONE/QPADEV0014) SPLNBR(1) FROM(*FIRST) TO(*LAST) TOSTMF(allreports.pdf) DIR('/myfiles/reports') MERGE(*YES)

SPL2STMF FILE(REPORT3) JOB(332340/BVSTONE/QPADEV0014) SPLNBR(1) FROM(*FIRST) TO(*LAST) TOSTMF(allreports.pdf) DIR('/myfiles/reports') MERGE(*YES)

SPL2STMF FILE(REPORT3) JOB(332340/BVSTONE/QPADEV0014) SPLNBR(1) FROM(*FIRST) TO(*LAST) TOSTMF(allreports.pdf) DIR('/myfiles/reports') MERGE(*LAST)

Notice that the last command is a duplicate of the previous, but *LAST is specified for the MERGE parameter. This last command is used to send information to the SPLTOOL command to finish processing and merge all the spooled files previously listed.


Important Notes about Merging Spooled Files

When merging spooled files it is important to remember the following items:

  • You should try to merge only spooled files that have similar attributes (such as page width, page length, CPI and LPI).
  • When using a format such as PDF or RTF where the attributes such as font size are dependant on the spooled file attributes, the last spooled file processed will be where SPLTOOL gets the information to format the resulting document.
  • When you are merging documents manually using the SPLTOOL interface, be sure that for the last command (when you specify MERGE(*LAST) to finalize the processing) that you specify *LAST for the To Page (TO) parameter. By default the SPLTOOL interface will insert the last page of the current document which may cause your final merged document to not contain all pages.
  • Only *SCS spooled files can be merged. These commands can NOT merge AFPDS spooled files into the document, even if you are using the AFPTOOL command.
  • When using the batch commands to merge spooled files, any spooled files found matching the criteria that are not *SCS will be ignored.

<<Previous | Next>>

© Copyright 1995-2008 BVS/Tools     
Powered by the eRPG SDK