Chapter 7 - Performing Specific Tasks with SPLTOOL
With SPLTOOL you are able to perform speicific tasks to make distribution or use of a spooled file easy. This section will list and explain some basic tasks that can be performed with SPLTOOL.
- Copying a spooled file to an Excel file
- Copying a spooled file to an HTML (web page) file
- Copying a spooled file to a Microsoft Write/Word file
- Copying a spooled file to a PDF Document
Copying a spooled file to an Excel file
Copying a spooled file to an excel file consists of two steps. The first step is to copy the desired spooled file to your PC with a text (.txt) extension. I prefer to use the FTP method as this gets the file directly to my PC. Others choose to copy the spooled file to a folder or directory in the Integrated File System (IFS) and then map a drive to this location. Either method will work.
It is advisable to remove headings from your spooled file, if possible, so that formatting of the excel file will be as smooth as possible. Instructions for removing standard headings from spooled files can be found in Chapter 2.
Once you have the spooled file copied, start your excel program on your PC.
Next, select the open file option. Change the "file of type:" option in the Open dialogue box to "All Files(*.*)". Now, find the file you just downloaded to your PC.
You will be presented by some questions by Excel now that will ask you how the data is formatted. The options should be Delimited and Fixed Width. This should be set at Fixed Width.
At this point, if you removed the headings from your report, you should be able to click the "Finish" button and excel will format your spooled file correctly. If not, you may have to go step by step through the process to tell excel where each column begins and ends.
Finally, once your data in in Excel, you may have some minor adjustments to do, like changing data types for columns, etc. If a column of data shows up as "########", this means that you will need to change the data type.
Copying a spooled file to an HTML (web page) file
Copying a spooled file to an HTML file is rather simple. The only thing you need to specify on the folder, stream file, or FTP options is a file extension of .htm or .html. When SPLTOOL sees this extension, it knows to throw in some HTML tags to format the spooled file so it will be viewable in a web browser.
The HTML title option can be used when copying a spooled file to an HTML file. This will put a title on the web page. The title is the text that shows up on the top bar of the browser. For you HTML programmers, this text is placed in between the <title> and </title> tags.
Once you have the file downloaded with the .htm or .html extension, simply double click on the file and your defualt browser should open up and display the file.
If you wish to specify certain fonts, font sizes or other HTML data, you can do so at the beginning and at the end of each document. A source physical files named SPLHTML exists in the SPLTOOL library. There are two members in this file. The first is named HTMLBEG. Any source in this file will be sent to the document before the actual data. The second file, HTMLEND, is sent to the document after all of the spooled file data has been copied.
As an example, if you wanted to make the font size smaller, your HTMLBEG member would appear as follows:
<HTML><PRE><FONT SIZE="1">
Also, you would need to change the HTMLEND member to have the following data:
</FONT></PRE></HTML>
The only requirements are the <HTML> and <PRE> tags. After these tags you can add any HTML you wish to change font sizes, format, even insert graphics.
If you wish to embed HTML in your original spooled file, you must have at least v7.33 and service pack ST020702 installed. To embed HTML in your spooled file, you must prefix the < and > characters with %%. For example, %%<a href="blah.com%%>Click Here%%</a%%>. This will then be converted to HTML instead of text.
If you already have multiple spooled files with HTML embedded in the data and do not wish to convert all of the < and > characters to %%< and %%>, make sure you have at least v7.33 and service pack st031202 installed. You can then issue the following command to override the HTML conversions:
CRTDTAARA DTAARA(QGPL/SPLCVTHTML) TYPE(*CHAR) VALUE(N)
Please bear in mind that if any < or > characters exist in your spooled file data that is not intended to be HTML this may corrupt your data.
Copying a spooled file to a Microsoft Write/Word file
Copying a spooled file to a Microsoft Write or Word document is even easier than copying to an HTML file. All you really need to do is specify a file extension of .doc when copying the spooled file via the folder, stream file, or FTP options.
The only real formatting that is performed is inserting page breaks where the natural page breaks occur in the spooled file into the target document.
Copying a spooled file to a PDF document
Copying a spooled file to a PDF document is a feature a lot of users have been asking for. To perform this option, simply specify PDF (or pdf) as the file extension when copying a spooled file to a folder, a stream file, FTPing or Emailing a spooled file.
The PDF option included with SPLTOOL will retain correct spacing, underlining, most bold attributes, and page breaks. SPLTOOL determines the font size and page orientation by the original spooled file attributes, looking up values you enter on the SPLPDFCFG command.
Copying a spooled file to a RTF (Rich Text Format) document
Copying a spooled file to a RTF document is another feature users have been asking for. To perform this option, simply specify RTF (or rtf) as the file extension when copying a spooled file to a folder, a stream file, FTPing or Emailing a spooled file.
The RTF option included with SPLTOOL will retain correct spacing, underlining, most bold attributes, and page breaks. SPLTOOL determines the font size and page orientation by looking up the values you enter in the SPLRTFCFG command.