[comp.os.vms] Printing from inside a program.

JDM@XX.LCS.MIT.EDU (Joshua D. Marantz) (12/02/87)

I would like to spool a file to SYS$PRINT or another print spooler from
a program.  I know I could lib$spawn a print command, and look at the
termination status, but I was hoping for a cleaner, faster way.  Any
ideas?

-Joshua D. Marantz
Viewlogic Systems, Inc.
-------

carl@CITHEX.CALTECH.EDU (Carl J Lydick) (12/02/87)

 > I would like to spool a file to SYS$PRINT or another print spooler from
 > a program.  I know I could lib$spawn a print command, and look at the
 > termination status, but I was hoping for a cleaner, faster way.  Any
 > ideas?

If, when you open the file, you set the bit FAB$V_SPL in the FAB$L_FOP field,
the file will be spooled to SYS$PRINT on CLOSE.

unknown@cunyvm.UUCP (12/03/87)

Look at the documentation in the system services manual for $sndjbc

jrv@siemens.UUCP (James R Vallino) (12/04/87)

On my system there is a logical ($PRINTER) defined which specifies the device
where the print spooler is aiming its output. If I open a file using the
file name '$PRINTER:' all output is directed to the spooler which queues the
print job when the file is closed. This was done from a C program with the
normal fopen() and other level 2 file calls without having to set any
fancy bits along the way.

Jim Vallino	Siemens Research and Technology Lab.,Princeton, NJ
CSNET: jrv@siemens.siemens-rtl.com
UUCP: {ihnp4,philabs,seismo}!princeton!siemens!jrv


-- 
Jim Vallino	Siemens Research and Technology Lab.,Princeton, NJ
CSNET: jrv@siemens.siemens-rtl.com
UUCP: {ihnp4,philabs,seismo}!princeton!siemens!jrv

gil@icus.UUCP (Gil Kloepfer Jr.) (12/05/87)

In article <12355095965.50.JDM@XX.LCS.MIT.EDU> JDM@XX.LCS.MIT.EDU (Joshua D. Marantz) writes:
>I would like to spool a file to SYS$PRINT or another print spooler from
>a program.  I know I could lib$spawn a print command, and look at the
>termination status, but I was hoping for a cleaner, faster way.  Any
>ideas?
>
>-Joshua D. Marantz
>Viewlogic Systems, Inc.
>-------

Summary of different fixes follow...


carl@CITHEX.CALTECH.EDU (Carl J Lydick) writes:

>If, when you open the file, you set the bit FAB$V_SPL in the FAB$L_FOP field,
>the file will be spooled to SYS$PRINT on CLOSE.


NEWCOMER@DICKINSN.BITNET ("Newcomer, Don") writes:

>Use the SYS$SNDJBC call.  It does the trick quite nicely!

-----

The former basically says what I am about to say in FORTRAN rather than RMS:

	OPEN(UNIT=unit#,FILE='banner-name',
             STATUS='NEW',DISP='PRINT/DELETE')

(I always get the STATUS and DISP keywords reversed...if they're backwards,
 I automatically admit I was wrong and no flames please! :-)

This will send all output to unit# to the specified file (I called it
banner-name since it will also be the name on the banner which is sometimes
displayed at the beginning of a print job) and will spool the file for
printing when closed.  I would imagine for other languages, if there isn't
a DEC enhancement (like in FORTRAN) which allows you to do this, then you
would mess with the bits in the FAB when you open the file (would be pretty
hard for most of us).

I don't know too much about the second idea...  I would look into that one,
but the above is so much easier to understand...

Hope this helps.

===============================================================================
Gil Kloepfer, Jr.                               ...ihnp4!icus!gil
Senior Programmer                                (or whatever path works best
Bowne Management Systems, Inc.                    on the day you reply!)
Mineola, NY    (516) 248-6840   ext 796
===============================================================================

ccscott@deneb.ucdavis.edu (Scooter) (12/28/87)

In article <12355095965.50.JDM@XX.LCS.MIT.EDU> JDM@XX.LCS.MIT.EDU (Joshua D. Marantz) writes:
>I would like to spool a file to SYS$PRINT or another print spooler from
>a program.  I know I could lib$spawn a print command, and look at the
>termination status, but I was hoping for a cleaner, faster way.  Any
>ideas?
>-------
One way to spool files to the various queues is with the SYS$SNDJBC call.
To use the service, specify that you want to do an add job command (rtfm) 
as your argument to SYSSNDJBC, and fill in the item stuff as per the doc-
umentation.  If you want an example, let me know, and I will send you some
of the stuff I have done with the queue controller.   I think if you can
figure out lib$spawn, you shouldn't have any trouble with this ....

-scott (formerly VMS Scooter, but alas, I got a real job ... :-( )
ucbvax!ucdavis!deneb!ccscott or some such.