startshp command

The startshp command starts a shared printer under UNIX. The output of the D3 printer process is routed to the UNIX spooler. This command combines the startptr command and the necessary assignfq command.

For Windows: Not Supported

Keeping track of shared printers is achieved using the shp-status command. Terminating a shared printer should be done using the shp-kill command. After a job has been submitted to UNIX, the (UNIX) lpstat command can be used to track the running jobs. The printer devices associated with the form queues must have a special interjob sequence so that the UNIX spooler can distinguish the end of the job.


startshp ptr.number,(q1{,q2{,q3}}}), eject.pages,type/address, (pd1{,pd2{,pd3}}})
{,(lp)} {(options}


ptr.number Indicates the printer number (integer).
q1, q2, q3  Indicates the output queue numbers.
eject.pages Indicates the integer number that specifies the number of pages to eject at the end of each job.
type/address Indicates the printer type and port number.

The printer type will be s (serial printer). All printers are treated internally as serial devices, even when (as in the case of a shared printer) the device is a pseudo device.

pd1, pd2, pd3 Indicates the printer devices.

To each form queue, a printer device, defined in dm,devices, must be associated to define the printer characteristics, as well as the interjob sequence.

The interjob sequence is defined in the function @(-269). If the number of printer devices is less than the number of form queues defined, the last device is used for the remaining form queues.

Note: The maximum number of form queues that can be defined is 2048.
lp Indicates a UNIX command used to spool the D3 print job.
  • If not specified, lp is used by default.
  • If the UNIX command has more than one word (separated by spaces), the command must be enclosed in parentheses.

Refer to the lppick command in either the D3 Linux System Administration Guide or D3 AIX System Administration Guide for lp command options.

options a

Initiates alignment process.

Note this is an option, while on the startptr command it is an argument. When this option is used, each alignment attempt is a UNIX job. The UNIX printer should have been set up so that there is no banner, no interjob page eject.

c Compiles the printer devices.

This option must be used whenever the printer definition item is changed.

s Inhibits the initial page-eject command at the start of a print file.

See the eject.pages parameter in the startptr command documentation for more information.

t{n} Traces shared printer activity.

Even when the trace is not activated, errors are recorded. n is a trace level. See the Trace information section for a description of each trace level.

v Verbose.

Various information displays on the terminal. This option should be used only to diagnose problems. It displays the amount of data that is transferred to the UNIX spooler.

When the printer is successfully started, a UNIX log file is created in the directory /var/tmp/lppick, which is used to keep track of the shared printer activity. The name of the file in this directory is formatted as:

vmn_ prt_ port


vmn Virtual machine name.
prt D3 printer number.
port Port number.

The log file contains the following elements, separated by attribute marks:

pid^ cmd^ eoj^


pid PID of the lppick process.
cmd UNIX command used to send data to the spooler.
eoj End-of-job string.

Trace information

Optionally, this file also contains trace information if the t{n} option is used or if an error is encountered. The level of trace is coded as follows:

1 (default) Record only beginning and end of jobs.
2 Record, in addition to level 1, each write to the lp command.
3 Record, in addition to level 2, all data that is exchanged. Non-printable characters are replaced with a period.
4 Record, in addition to level 2, all data that is exchanged. All characters are replaced by their hexadecimal value coded on two ASCII characters.

The trace is stopped only when the printer is stopped with the shp-kill command.

The log file is used by the shp-status command to keep track of printers shared with UNIX and the processes involved, and by the shp-kill command to find the processes to terminate.

The startshp command supports all startptr options, plus those listed.

Warning: A FlashBASIC program cannot execute a startshp using the capturing clause, due to the various UNIX pipes created by this command.

This command requires the lppick program to be installed on the system. This utility is typically shipped with the system and loaded in /usr/bin. When a level 3 or 4 trace is active, the size of the trace file grows very rapidly and fills the file system /tmp. This may have some impact on the system. It is recommended to use a level 3 or 4 trace with caution, and check the size of the files in the /tmp/lppick directory.


Example 1

Starts printer 3, serving form queues 2 and 3, both associated to the same printer device lp.unix, with one page eject after each job (required for a laser printer), on port 32.

 startshp 3,(2,3),1,s32,lp.unix (s

Example 2

Starts printer 4, serving form queue 7, associated to the printer device lp.unix, with one page eject after each job (required for a laser printer), on port 33, using the UNIX command lpr to access a remote printer.

 startshp 4,7,1,s33,lp.UNIX,lpr (s

Example 3

Starts printer 5, serving form queues 8 and 9, respectively associated to the printer devices lp.unix and lp.lzr.unix, with one page eject after each job (required for a laser printer), on port 34, using the command lp -n 2 -o nobanner to generate 2 copies of each job and to remove the banner.

 startshp 5,(8,9),1,s34,(lp.unix,lp.lzr.ux),(lp -n 2 -o nobanner) (s

Example 4

Starts printer 6, serving form queue 10, associated to the printer device lp.unix, with no page eject after each job, on port 35, using the command cat >> /tmp/print to send all print jobs into a regular UNIX file.

 startshp 6,10,0,s35,lp.unix,(cat >> /tmp/print) (s

Example 5

Starts printer 7, serving form queue 99, associated to the printer device lp.unix, initiating the alignment process. Jobs must have been queued on the specified form queue for alignment to be attempted.

 startshp 7,99,0,s16,lp.unix (a

Example 6

Starts printer 8, serving form queue 97, associated to the printer device lp.unix with a level 2 trace.

 startshp 8,97,0,s17,lp.unix (t2