Operating System - OpenVMS
1745795 Members
3468 Online
108722 Solutions
New Discussion юеВ

How does spooling work on OpenVMS?

 
SOLVED
Go to solution
Cass Witkowski
Trusted Contributor

How does spooling work on OpenVMS?

I've been trying to locate information on just how spooling works on OpenVMS. If I have a LTA23: device I can open it from a program and write output that will go to the connected printer. Now if I want multiple people to beable to use the device at the same time I set up a device queue and set the LTA23: device as spooled. Now I can have multiple people open the LTA23: device and write to it but in reality they are each writing to a different file which then when closed will be submitted to the queue I have set up.

I know that when I spool the LTA23: device I can ANALYSIS/SYSTEM and do a SHOW DEVICE LTA23: that there is now a AMB block defined with the address of the UCB for the disk the device is spooled to.

I know that if I have multiple nodes in a cluster and I create the LTA23: device on all the nodes that the queue symbiont only has one allocated at a time. I can actually do a SET DEVICE/NOSPOOL LTA23: on the nodes that symbiont is not running.

I recently learned that you can have one device spooled and point to a queue that is a generic queue such that you may not actually end up printing on that device at all. If you think about it if you have LTA23: created on all nodes and the symbiont is only attached to it on one then all nodes can open LTA23: write data and get it queued up to the queue and printed.

So what I want to know is:

1) How does the spooled device know the difference between a program opening the LTA23 device to write to it and therefore to be spooled to a file and when the symbiont opens the device and actually needs to write out to the printer attached to it?

2) Why when you spool a device does it open a connection to the spooled disk. why not just when you need to actually open a file? The reason I ask this if that if you spool to a disks that is not the system disk and the disk is a shadow disk with Host Base Volume Shadowing (HBVS) that you can't get a clean dismount on the disk when you shutdown a node that it always goes into shadow merge.

So would it be possible to not have the LTA devices that are spooled to a disk keep that disk from being dismounted cleanly.

Anyway this got me thinking and inquiring minds want to know. So if you know the answer or can point me to where it is please do so. I tried looking in the internals but could not find anything.

Thanks

Cass
19 REPLIES 19
Volker Halle
Honored Contributor
Solution

Re: How does spooling work on OpenVMS?

Cass,

you set up device spooling with:

$ SET DEVICE dev:/SPOOLED=(queue-name,intermediate-disk-name)

dev: must be a sequential terminal or printer device.

Spooling is implemented in the File System (XQP). You can find some information about spooling in the VMS File System Internals book (ISBN 1-55558-056-4).

This answers question 1: if the device is spooled, the virtual file system function IO$_CREATE honors the spool characteristics of the spooled device (e.g. LTAn:) and creates an intermediate spool file (no direcotry entry !) on the associated 'spool device' (i.e. intermediate disk name) pointed to by UCB$L_AMB.

Once the spooled device (LTAn:) is de-accessed, the XQP automatically sends the spool file from the intermediate device to the associated print-queue (just like a PRINT/DELETE).

You need to use XQP functions ($OPEN) when writing to the spooled device (terminal/printer), logical QIOs won't work. Normally your application will be implicitly using RMS (like $ COPY file LTAn:).

The Print-Symbiont will be using $ASSIGN and IO$_WRITELBLK and - as it it sufficently privileged - directly write to the LTAn: device. The print-symbiont itself has NOTHING to do with spooling, he is just processing a print-job. So there is no need at all for LTAn: devices to be set spooled, except if your applications need this functionality (writing to a terminal/printer device, which needs to be shared and handled by a print-symbiont).

There is no implicit association between the LTAn: device and the print-queue. You can spool device LTA1: to a print-queue, which will run on LPA7: - if you want to. And it can also be a generic queue, as you've found out.

When a device is spooled (to an intermediate-disk-device), a counter is incremented in the VCB (Volume Control Block) for that device (VCB$L_SPL_CNT), which counts the no. of devices spooled to that volume. You cannot dismount that volume, if VCB$L_SPL_CNT is greater than zero. You'll get an appropriate error message from DISMOUNT:

%DISM-W-SPOOLEDEV, 1 device spooled to volume

To cleanly dismount your shadowset during shutdown, you need to UNSPOOL ($ SET DEV/NOSPOOLED LTAn:) all your LTAn: devices in SYSHUTDWN.COM, which have been spooled to that volume. This will also be true for a non-shadowed disk, but you'll just get a REBUILD during mount instead of a SHADOW-MERGE, which is more visible.

Volker.
Volker Halle
Honored Contributor

Re: How does spooling work on OpenVMS?

Cass,

just by pure coincidence, I had just written a command procedure for one of my customers to find spooled devices, which prevent a clean dismount during shutdown.

$ DEFINE fsp_tmp "SYS$LOGIN:fsp_''F$GETJPI("","PID")'.TMP" ! temp file
$ fsp_tmp1 = "SYS$LOGIN:fsp1_''F$GETJPI("","PID")'.TMP" ! another temp file
$!
$ ANAL/SYS
SET OUT/NOINDEX fsp_tmp
SHOW DEV LTA
$!
$! intermediate disk UCB address is in AMB
$ SEARCH fsp_tmp AMB,UCB: /OUT='fsp_tmp1'
$ DELETE/NOLOG/NOCONFIRM 'F$TRNLNM("fsp_tmp")';*
$!
$ WRITE SYS$OUTPUT "The following LTA devices are still spooled to a disk:"
$ WRITE SYS$OUTPUT ""
$ SEARCH 'fsp_tmp1' AMB/WIND=(1,0)/NOHEAD
$ DELETE/NOLOG/NOCONF 'fsp_tmp1';*

This should be treated as an example on how to locate spooled devices in an OpenVMS system.

As always, you need to reverse things set up in SYSTARTUP_VMS.COM during SYSHUTDWN.COM, so you need to find your SET DEV/SPOOLED commands and add the appropriate SET DEV/NOSPOOLED commands during shutdown. The above procedure could also be enhanced to do this automatically - left as an excercise for the forum readers ;-)

Volker.
Jan van den Ende
Honored Contributor

Re: How does spooling work on OpenVMS?

Cass,
as Volker pointed out, there is no direct connection between a SPOOLed device and a print queue - other than ytat normally after closing the spool device a print job is triggered.
For the last 20 years I have considered the use of issuing print lines to a device from inside an image as a relic of the past. A much more convinient way is to educate the programmers, and do the writing to FILE, and some time after print the file.

If there are no programs that OPEN the device directly in the executable, there is no need for spooling, and also no need to SET the device SPOOLed.
Some 15 years ago I began removing any SET DEVICE /SPOOL I found, and I only found ONE programm that used it... and on pointing out to the development department that I liked that changed, I got a --HAPPY-- reaction, because that explained the issues they were having with it, and now they were easy to solve!!

So: if you MUST, then it is working (probabably, no recent experience), but if you can, GET RID OF THEM!!


hth

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Uwe Zessin
Honored Contributor

Re: How does spooling work on OpenVMS?

Welcome to the club of SPOOL-haters ;-)

When I talk to customers I often learn that they do it, because they see it in examples, not because they really need spooled devices.
.
Bojan Nemec
Honored Contributor

Re: How does spooling work on OpenVMS?

Hi,

People use spooled devices only to avoid broadcasts to their printers. It is much better to avoid this with a set terminal/nobroadcast. Programs which write directly to the printer are rare (probably they come from a non VMS environment).

Bojan
Uwe Zessin
Honored Contributor

Re: How does spooling work on OpenVMS?

I have never heard that first argument before.

And I have seen software sending its output to spooled devices that heavily uses FMS + RDB.
.
Wim Van den Wyngaert
Honored Contributor

Re: How does spooling work on OpenVMS?

I have a big, very old DSM application.

For each lta device they have a logical 1,2,3,4,... . The programs simply open 1 and writes to it. The application counts many millions of cryptic DSM lines that nobode really knows. Changing this application and retesting it would take months. So, nothing changes.

1 elements that I found missing in the spooling : show device/spool.

Wim
Wim
Antoniov.
Honored Contributor

Re: How does spooling work on OpenVMS?

Cass,
I agree it is possible not use spooled devices. I don't never know the syntax of spool!
Like Henry Ford said, any thing didn't used can't break!
Bojan, I'm amazed some people use spooled devices to acoid SET TERM/NOBROAD :-O

Antonio Vigliotti
Antonio Maria Vigliotti
Jan van den Ende
Honored Contributor

Re: How does spooling work on OpenVMS?

Wim,

yes, your argument is valid.
And, when confronted with them, I also found it very annoying that is was not possible to see which devices were spooled to a certain disk.
I guess you should send a friendly request to Guy Peleg at HP.
He _IS_ looking forward to DCL improvement requests, especially those that have real practical value.
I guess this might qualify!

jpe
Don't rust yours pelled jacker to fine doll missed aches.