z/OS Infoprint Server User's Guide
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF


Examples -- lp

z/OS Infoprint Server User's Guide
SA38-0695-00

Examples -- lp

Print a file on the default printer

To submit the file File1 to your default printer, enter:

lp File1

Print a file on a specified printer

To submit the file File1 to the printer fred, enter:

lp -d fred File1

Print a file on an undefined LAN printer

You want to print the file File1 on a LAN printer at a remote site. Your administrator has not defined this printer. You must specify:

  • The name that your administrator has defined to represent all remote printers (for example, remote)
  • The printer’s Internet Protocol (IP) address
  • The remote print queue

Enter:

lp -d remote -o "print-queue-name=text
   printer-ip-address=leo.boulder.ibm.com" File1

Print an MVS data set

To submit the MVS™ data set hlq.FILE1.LISTPS to your default printer, where hlq is your user ID, enter:

lp //FILE1.LISTPS

To submit the MVS data set FILE2.LISTPS to your default printer, enter:

lp "//'FILE2.LISTPS'"

Print a multi-document job

To submit the files File1 and File2 to the default printer, enter:

lp File1 File2

Each file is spooled to the printer separately.

Print a file-reference document

A file-reference document is a list of similar printable files that are separated by spaces, tabs, or new lines. For example, the file bills.list contains a list of files, each containing one customer’s monthly statement. It looks like this:

40009801.dec97
40009802.dec97
40009803.dec97
40009804.dec97

·
·
·

To print all the files listed in bills.list on your default printer, enter:

lp -o document-type=file-reference bills.list

The files are concatenated and printed as a single file.

Transform and print a job

If a transform product is installed, you can submit a job in a format different from the ones the printer accepts.

To print the PCL file sample.pcl on the AFP printer printer1, enter:

lp -d printer1 sample.pcl

If you want to specify options for a file that is being transformed to AFP, you must use the filter-options attribute with the lp command. For example, to print pages 3–10 of the PCL file sample.pcl on the AFP printer printer1 as an overlay, enter:

lp -d printer1 -o "filter-options='-p 3-10 -t overlay'" sample.pcl

If you want to specify job attributes for a file that is being transformed from AFP, you do not use the filter-options attribute with the lp command. You only use filter-options to specify -c and -i options. For example, to print the AFP file sample.afp on the PCL printer PCLPRT and printing in duplex, enter:

lp -d PCLPRT -o 'duplex=yes' sample.afp

To print the AFP file sample.afp on the PCL printer PCLPRT using the transform class US and print in duplex, enter:

lp -d PCLPRT -o "filter-options='-c us' duplex=yes" sample.afp

Print multiple copies of each file

To print two copies of each file on the default printer, enter one of these:

lp -n 2 Title Contents Body1 Body2 Append
 
lp -o copies=2 Title Contents Body1 Body2 Append

This command prints two copies of Title, followed by two of Contents, and so forth for each file in the job.

Tip:
VTAM-controlled printers (IP PrintWay™ basic mode only) and some IPP-enabled printers do not support printing more than one copy. In this case, only one copy prints. If the file is sent to an email destination instead of to a printer, only one copy is sent.

Print a file on both sides of the paper

To print file File1 on the default printer and to print it on both sides of the paper, enter:

lp -o duplex=yes File1

Specify the attributes files

To print file File5 on the default printer and to specify the two attributes files default.att and special.att, enter:

lp -o "attributes=default.att attributes=special.att" File5

Suppose that the file default.att contains these lines:

input-tray=bottom
duplex=yes
output-bin=collator

The file special.att contains these lines:

input-tray=top
copies=5
title-text='Special Report'

The preceding command is equivalent to this command:

lp -o "input-tray=top duplex=yes output-bin=collator
   copies=5 title-text='Special Report'" File5

The value of input-tray in special.att overrides the value in default.att because you specified special.att last.

Tip:
These examples assume that the attributes files are in the current directory, or that you have set the AOPPATH environment variable to include the directories where the attributes files reside. If this is not the case, you would specify the attributes files by their absolute path names.

Override an attribute value in an attributes file

To print file File1 on the default printer and override the value of yes for the duplex attribute specified in the default.att attributes file, enter:

lp -o "attributes=default.att duplex=tumble" File1

Specify the AOPOPTIONS environment variable

To set the AOPOPTIONS environment variable to your address, add a line like this one to your .profile file:

export AOPOPTIONS="address-text={'13 Division St.' 'Foxboro, MA 02035'}"

Until you reset the AOPOPTIONS environment variable, every lp command you enter includes this value. For example, this command:

lp myfile.ps

is equivalent to:

lp -o "address-text={'13 Division St.' 'Foxboro, MA 02035'}" myfile.ps

Because the lp command reads the value of the AOPOPTIONS environment variable before the options you specify on the command line, you can override the values of this variable. For example, if you want a single job delivered to a different address, enter:

lp -o "address-text={'999 Eclipse Alley' 'Pawtucket, RI 02860'}" myfile.ps

Request notification by message

To print file File1 on the default printer and to receive a message when the file is printed, enter:

lp -w File1
Tip:
If the printer is a LAN printer, the lp command writes an email when the file is transmitted to the printer. When you receive the email, the file might not actually have finished printing.

Submit and hold a job

To submit file File1 to the default printer and to hold it so that it does not print until the operator releases it, enter:

lp -o hold=true File1

Specify a code page for ASCII files

To print the files File1 and File2 and to specify the code page ISO8859-1, enter:

lp -d Printer1 -o document-codepage=ISO8859-1 File1 File2

Print from standard input

You can use the lp command to print the output from other commands. For example, to print a list of all the files in the current directory, enter:

ls -la | lp

Paginate line data and print with a header on each page

If your administrator has specified the LPD compatibility filter (lpd_compat.so) for the printer in the Printer Inventory, you can specify filter options that are equivalent to the FILTER, WIDTH, and LINECOUNT options of the z/OS Communications Server (TCP/IP) LPR command. The LPD compatibility filter can be used with text and line data when you print on an AFP printer or a JES line printer. For a description of the options that the LPD compatibility filter supports, see filter-options.

To print data set MYDATA, which contains line data, on the AFP printer afpprinter, with a header on each page, a maximum width of 80 characters, and a maximum length of 60 lines, enter:

lp -d afpprinter -o "filter-options='-f p -w 80 -l 60'" "//'MYDATA'"
 

Send multiple files to an email destination specified in the printer definition

To send files File1 and File2 to the email address list in printer definition deptmail, specify a subject for the email, and specify a form definition that is used when the AFP data is converted to PDF format, enter:

lp -d deptmail -t "Monthly Report" -o "form-definition=F1MYDEF" File1 File2

This example assumes that the AFP to PDF transform is requested for AFP data in the printer definition named deptmail.

Results: The recipients listed in printer definition deptmail receive two emails:

  • The sender of the emails is the user ID of the user who entered the lp command. The domain name is the system where sendmail is running.
  • File File1 is attached to one email, while file File2 is attached to another email. The name of the attachments are: FILE1.pdf and FILE2.pdf. The files are in PDF format and can be viewed and printed with Adobe Acrobat Reader.
  • The subject of both emails is Monthly Report.

Send a file to an email destination specified in job attributes

To send file File1 to the email addresses specified in job attributes instead of to the email addresses specified in the printer definition, and also specify a subject, sender name, attachment name, and reply address for the email, enter this command on one line:

lp -d emaildest -t "Monthly Report" -o "mail-to-addresses={'user1@xyz.com'} 
   mail-cc-addresses={'user2@xyz.com'} mail-bcc-addresses={'user3@xyz.com'} 
   mail-file-name='February 2004 sales report' mail-from-name='John Q. Sender' 
   mail-reply-address='secretary@xyz.com'" File1

This example assumes that the AFP to PDF transform is requested for AFP data in the printer definition named emaildest.

Results: An email is sent with these specifications:

  • The subject is Monthly Report.
  • The recipient of the email is user1@xyz.com.
  • The copy (cc) recipient is user2@xyz.com.
  • The blind copy (bcc) recipient is user3@xyz.com.
  • If the file is in an attachment, the attachment is called February 2004 sales report.txt.
  • The sender of the email is John Q. Sender<JOHN@SYSTEM1>. The user ID of the user who entered the lp command is JOHN. The domain name of the system where sendmail is running is SYSTEM1.
  • The email address that recipients can reply to is secretary@xyz.com.
  • The file that is attached is FILE1.pdf. The file is in PDF format and can be viewed and printed with Adobe Acrobat Reader.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014