From: MERC::"uunet!WKUVX1.BITNET!MacroMan" 30-MAR-1993 11:26:28.62 To: MACRO32@WKUVX1.BITNET CC: Subj: Re: help with program to do $ set dev/spool In article <1993Mar29.220253.688@hhcs.gov.au>, fultod@hhcs.gov.au writes: > I'm trying to write a C programme that sets up some printer devices, ie > I want it to do the equivalent of- > > $ mcr latcp set port ltan: /node= server-name /port= port-name > $ set terminal ltan: /permanent /page= 66 ... > $ set device ltan: /spooled= (queue-name, disk) > > I've used $qiow to do the same as the first two commands but I have no idea > how to do the $ set device /spool. Can someone please point me in the right > direction? Is this documented anywhere? > It is actually SET.EXE that does the spooling, and it doesn't call any system services to do the work. It does it all itself in kernel mode, so the news is bad I'm afraid. In user mode it assigns a channel to the device to be spooled and calls $GETDVI to get a bit of info on it. Then it goes up to kernel mode (by virtue of CMKRNL privilege which it is installed with), and : o locks the I/O database for write access o checks the device is a terminal or printer (but not a remote terminal), that it is not already spooled, and not allocated to anyone o checks the intermediate device (the disk) is mounted, not in the process of being dismounted, is file oriented and a random access device o allocates some non-paged pool to make a pseudo volume control block (VCB), does some bare initialisation of this VCB, including inserting the queue name in it, and hangs it off the UCB of the device to spool (in your case the terminal) o fiddles UCB addresses so that the device's UCB can access the intermediate device's UCB o increments the reference count, transaction count, and spooled count for the spooled device o unlocks the I/O database and resets IPL to 0 In short, you *could* do it yourself, but unless you are prepared to update it with every version of VMS where it changes, you might be stuck with SET.EXE. Craig McGill. VMS System Programmer. PS. I've just noticed that the code does not deassign the channel to the device that it assigned in user mode. No problem (because it's in user mode) but bad programming ! Naughty Digital ! [VMS is a trademark of Digital Equipment Corporation !] [I hate putting disclaimers and the like at the end of these ]