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