gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] ASSIGN for printer.


From: Franklin Ankum
Subject: Re: [open-cobol-list] ASSIGN for printer.
Date: Fri, 27 Oct 2006 08:52:20 +0200


The following do not work:
            SELECT PRINTFILE ASSIGN TO PRINTER.
            SELECT PRINTFILE ASSIGN TO "PRINTER".

This is Slackware Linux. The printer is  /dev/lp. The printer is
PostScript. Error msg:
libcob: WRITE not allowed (STATUS=48) File : 'PRINTER'

Permissions on directory are 777.

Never mind--stupid mistake. I would still like to know how to route the file
directly to a printer, like in the old days.


Printing in Cobol is done by writing to a sequential file. This file may be a pipe if you wish. In unix/linux you would create a pipe with "mkfifo" then write to this file from your cobol program.
I use external variables for assigning files ("cobc -std=ibm")

export PRINTER=myprintpipe
mkfifo myprintpipe
# now start a print process which reads from the pipe
lp - < myprintpipe &

# and run your cobol program
myprog

Once your Program starts writing to "PRINTFILE" it will immediatly be
directed to the printer specified in the "lp" process.

And you can also assign your file to any device
export PRINTER=/dev/console # for example

Regards
Franklin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]