Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending output directly to printer on Unix through cobol program

Status
Not open for further replies.

krickb

Programmer
Nov 19, 2003
11
US
I have written a program that assembles data and sends it to an HP laserjet printer for printing. I can get it to work on a Windows platform using ASSIGN 'Printername'.

However, I am not sure how to do this when I run it on the Unix environment. If I use ASSIGN 'Printername' , I get the data in a file named Printername.

I have tried putting lp -d in the ASSIGN statement, I get the same results..file named as lp -dPrintername.

Is it possible to use ASSIGN to send directly to a printer in UNIX???

Thanks for any advice anyone may have.
 
Your installation should have a pre-designated (configured) name for the printer(s).

Then, you can do this, for example:

ASSIGN TO PRINTER1

Dimandja
 
Sending the output directly to the printer is NOT advisable.
You should use the spooler.
If you with to send directly to the printer you can do as follows.
ASSIGN to "/dev/printerport" (normally /dev/lp0 for the parallel but this depends on Unix version/vendor)
or
setting an environment variable
(bourne shell)
Printername=/dev/printerport
export Printername

In the program
ASSIGN 'Printername'.

As you did not mentioned which COBOL vendor I am going to tell you how to do it on RM/COBOL.

If you look at the users guide and at one of the supplied configuration files (terminfo.cfg or termcap.cfg) you will notice that there is an option for DEFINE-DEVICE that contains an example for PRINTER, and with an PIPE=yes and with part of the line like "lp -d printername -s -c"

This will use the spooler, and is the way you really should do things.

If you are using RM and don't have the manual available you can get it from the internet at
ACUCOBOL has a similar way of doing things, but you can put the "lp -d printername" directly on the assign.





Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top