How can I strip out the Carriage Controls from a spool file?
Tony Summers replies:
Without dropping into Posix shell, the only other idea that comes to mind would be some third party tool. SPOOLPDF was a program we used from Open Seas to convert spoolfiles into raw PCL. A second program (OPENPDF) subsequently converted the PCL to a PDF document. OPENPDF was simply ported version (to MPE) of a Unix application (pcl2pdf). And we still use pcl2pdf on our HP-UX servers.
Lars Appel pulls a new approach out of his files:
Well, EDITOR.PUB.SYS also can change or replace columns.
/CHANGEQ 1/1 to "" in ALL
This changes column 1 through 1 to "nothing" in all lines (quietly).
If you don't want to strip CCTL but convert it to PCL escape codes, you might try using the network spooler (which typically does this when sending a file to the JetDirect printer). Example programs are in the HP3000-L archives, such as listening for TCP port 9100 to capture such data sent by the network spooler. Look for the FakeLP challenge with examples in Java, Perl, and C.
I use Beechglen's SF2HTML utility. It's a convenient tool to convert CCTL codes to line and form feeds. Then I run it through an editor to get strip the HTML code. It only generates three codes, "<HTML>", "<BODY>", and "<LISTING>". Easy enough to convert to blanks or nothings. Then use the Sanface Software program txt2pdf to convert the edited file to the final result.
Beechglen's Doug Werth notes
With enhancements in later versions, SF2HTML can be controlled by several variables, including one to remove the HTML tags from the output. This eliminates the extra step of running the resulting file through an editor before feeding it to txt2pdf.
Dave Powell offers a command file alternative:
Many moons ago I wrote a command file, HP2RTF to convert a cctl file to word-processor-readable rich-text format, converting the carriage control codes to the appropriate number of line-feeds as part of the process. It's happier if you redirect your output to a CCTL disk file, but it can sort-of handle spool files too. It contains its own complete source code, so if it doesn't do exactly what you want you can tweak it.