6.3 PRTPUB (Mainframe Print Publishing Pprogram)

The mainframe print publishing program is written by Dan Nelson and can be obtained in the file section
of the Hercules-390 discussion group (

http://groups.yahoo.com/group/hercules-390 ).

6.3.1 Function

The mainframe print publishing program was designed to be used with Hercules' printing facilities. Her-
cules emulates line printers as simple text files containing printed output. This output can be viewed using
a text editor or some other mechanism (such as being served via a web server).

This PRTPUB program converts the raw printer output to a more readable form by replacing form feed
characters with line break lines, converting newlines to CR/LF pairs if desired (for Windows viewing), and
placing the result in a specified file.

Several facilities are provided to allow for publishing the printed output in an automated way (e.g. to a
web server) as follows.

1) You can choose to publish the output only if the input file size has changed since the last time the pro-
gram was run. The file size is stored in a file for comparison on each run and the program terminates with
return code 4 if the input file size has not changed since the last run. This allows efficient mirroring of the
printed output to a separate file on a schedule, only updating the target file if the source file has changed.
There is also an option that permits the polling for change to be carried out in this program, thus saving
the resources that would otherwise be used to launch the program, parse the options, and so forth on
each iteration.

2) You can choose to publish only the last part of the printed output. Hercules printer files tend to grow
and grow in size and users are typically only interested in the last part, printed most recently. An option
lets you specify the number of lines at the end of the file to publish to the target file, or lets you publish
only the new data since the last run.

3) Locking is provided under UNIX type operating systems. As a courtesy this program will acquire an ad-
visory read lock on the entire file before it starts processing. If the emulator uses an advisory write lock
then this program can be scheduled to publish the output asynchronously to the emulator producing that
output and the result will always be consistent.

4) If you want to publish the output as a web page without using a mechanism like server side includes,
this program provides the option of supplying HTML tags to wrap the output, although this facility is only
rudimentary. For sophisticated formatting server side includes are likely more appropriate to pull data into
a page but this facility may be useful for simple scenarios.

The program should be used in a batch file. It is possible to use it for a single call or to build a loop for
continuous processing (see examples below).

The possible return codes and their meaning are:

0 Translation was done.

4 Translation was skipped because the file size did not change.

8 Processing failed for an ordinary reason. An error message is sent to stderr indicating why.

16 Processing failed due to some abnormality. An abend code is given for diagnostic purposes. This
code will be the source line where the error occurred so you can use it with the source listing to
diagnose the cause of the failure.

6.3.2 Syntax


PRTPUB inputfile,outputfile [,[sizefile] ,[
interval] ,[taillines]

,[CRLF] ,[HTML] ,[NOPB]]


Êʬ¬¬ PRTPUB ¬¬¬ inpufile,outpufile ¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ÊÍ

¬ , ¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬§¬¬¬¬¬¬¬¬¬¬Ê

sizefile ¬¬¬¯

ʬ¬¬ , ¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬§¬¬¬ , ¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬Ê

interval ¬¬¬¯

taillines ¬¬¬¯

ʬ¬¬ , ¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬§¬¬¬ , ¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬Ê

CLRF ¬¬¬¯

HTML ¬¬¬¯

ʬ¬¬ , ¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬§¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ÊÍ

NOPB ¬¬¬¯

6.3.3 Parameter

The program takes a single long argument which must not contain spaces. If the file paths (on Windows)
contain spaces then the entire argument must be enclosed in quotes. No spaces are allowed anywhere
else, whether or not quotes are used. If quotes are used then they are only permitted as the first and last
characters of the argument string.

The argument is divided into sub parameter separated by commas. All parameter are positional, if they
are omitted a comma must mark their place.


The file containing the emulated mainframe output.


The file to which the result is to be published.


The file containing the input file's size at the time of the previous run. If specified,
this file is used to track the size of the input file, only publishing when it changes.
The file will generally not exist the first time it is specified. In that case, the pub-
lishing is done and the file is written for use in subsequent runs. The file contains a
number in binary form. It cannot be directly edited. If this parameter is not specified
then the publishing is always done regardless of the file's size.


The polling interval for use with the size file. If this argument is specified it must be
a positive integer and it indicates a number of seconds between file size checks. In
this mode if the input file's size has not changed since the last invocation (based on
the size stored in the size file), the program goes into polling mode where it con-

Previous Page Next Page