z/OS Communications Server: IP User's Guide and Commands
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF

LPQ command—Request a list of the printer queue on a remote printer

z/OS Communications Server: IP User's Guide and Commands


Use the LPQ command to request a list of the printer queue on a remote printer from the LPD server controlling that printer.

  1. Do not use the forward slash character (/) in any parameter value for this command.
  2. The TSO LPQ command uses the Pascal socket API, so VMCF must be started for the command to be successful. If VMCF is not active, an ABEND0D6 can occur.


Read syntax diagramSkip visual syntax diagram
        '-job_id-'  '-(--| Opt Parms 1: |--| Opt Parms 2: |-'   

Opt Parms 1:

   '-ALL-'  '-Printer --name-'  +-Host --host-+   
                                '-AT --host---'   

Opt Parms 2:

   '-TRace-'  '-TYpe-'  '-Version-'   


Specifies either a user ID (this cannot start with a digit), or a job number in the remote printer queue. If you do not specify job_id with the LPQ command, all the jobs in the remote printer queue are listed.
Note: job_id is case sensitive on some systems.
Prints a long report, which shows the source host and other print job information.
Printer name
Specifies the name of the printer for which you want the printer queue listed.

The printer name cannot contain an @ symbol.

Host host
Specifies the name or IPv4 IP address of the printer host. The name must resolve to an IPv4 address. AT is a synonym for this option.
AT host
Specifies the name or IPv4 IP address of the printer host. The name must resolve to an IPv4 address. Host is a synonym for this parameter.
Turns on the trace details for interaction with the remote printer. TRace always overrides TYpe because TYpe is a subset of TRace. Use this option whenever you need to document a problem.
Displays the progress of the command.
Displays the version of the program.


  • Query the printer lp0 on the system os2sys1 and print a short listing of the jobs that are queued for the lp0 printer:
    LPQ (PRINTER lp0 HOST os2sys1
  • If the LPRSET command was previously issued (LPRSET lp0@os2sys1), using the following LPQ command has the same effect as issuing the command in the previous example.
  • Get a long listing of the jobs queued, including the name of the host that created the jobs:
    LPQ (PRINTER lp0 HOST os2sys1 ALL
  • List the jobs for a user named smith:
    LPQ smith (PRINTER lp0 HOST os2sys1
  • Get information only about job 123:
    LPQ 123 (PRINTER lp0 HOST os2sys1


  • If the printer or host name are not specified in the LPQ command, the last LASTING.GLOBALV variables for PRINTER and PRTHOST in the user_id.LASTING.GLOBALV data set are used as the defaults. You can specify these variables with the LPRSET command. You can use these variables to set up a default printer and host to be used if you do not specify a printer or host.
  • User names in a query are case sensitive. For example, smith and SMITH are not the same names. Also for example, on UNIX systems, lp0 and LP0 can refer to different printers.
  • Some systems do not answer with the job information when you use a job number for a job that was not produced by the querying system.
  • You would not normally use the LPQ command to query an MVS™ system, because the LPD queue on MVS processes so quickly.
  • The input string for parameters is limited to 255 bytes. To use the input string effectively, remove any extra embedded blanks and use shorter parameter labels. For example, use P instead of the fullword Printer as a parameter.

Go to the previous page Go to the next page

Copyright IBM Corporation 1990, 2013
This information center is Built on Eclipse™ ( www.eclipse.org ).