info-vax@ucbvax.UUCP (02/04/86)
I am trying to print a file "foo.bar" from C under VMS 3.6. I have been successful at using LIB$SPAWN to spawn the command "print foo.bar" BUT this will ONLY work with an interactive session. It fails as a detached process and a batch job. I had originally hoped that there would be a "print.exe" that I could use SYS$CREPRC on but alas there is none. Could anyone give me pointers on how to print a file given a string containing the file name and the appropriate options. It MUST be able to run as either a batch job or a detached process. -David Robinson ia-sun2!david@csvax.caltech.edu seismo!cit-vax!ia-sun2!david
RAY@SRI-KL.ARPA (02/06/86)
The best way to submit a print job if there are no options is to, works for both v3.x and v4.x, is to set the FAB$V_SPL bit in FAB$L_FOP in the file FAB (Translation set the bit that says this file should be spooled to SYS$PRINT in the long word Fab OPtions of the File Access Block). If you need to specify a different queue with options then the best bet is to use the $SNDSMB system service for V3.x or the $SNDJBC system service for V4.x (The $SNDSMB is being replaced). You should refer to the "Record Managment Services" and "System Services" for details on the different methods. Lib$spawn requires a CLI to do it's setup and therefore doesn't work from a detached process. Ray -------
info-vax@ucbvax.UUCP (02/07/86)
You can use sys$creprc to run the image loginout.exe. You can then send (through a mailbox) the print command and then a logout command. Random (Randy Buckland) Research Triangle Institute ...!mcnc!rti-sel!rcb
info-vax@ucbvax.UUCP (02/09/86)
I hit the same problem. Until VMS 4.x, the only way to print a file from a program was to call sys$sndsmb, but first you had to look up the FID of the file via RMS system services such as OPEN...all in all, very messy. The best solution is to upgrade to VMS 4.x; short of that, you've got to write at least two system service calls, and they're messy ones at that. There is an example of how to do similar stuff on DSIN, however. -- Jon Krueger UUCP: ...seismo!rochester!ur-tut!tuba USMAIL: University of Rochester BITNET: TUBA@UORDBV Taylor Hall Phone: (716) 275-2811 work, 473-4124 home Rochester, NY 14627
info-vax@ucbvax.UUCP (02/10/86)
In article <8602062145.AA26209@ucbvax.berkeley.edu> RAY@SRI-KL.ARPA writes: > >The best way to submit a print job if there are no options is to, works >for both v3.x and v4.x, is to set the FAB$V_SPL bit in FAB$L_FOP in the >file FAB (Translation set the bit that says this file should be spooled >to SYS$PRINT in the long word Fab OPtions of the File Access Block). >If you need to specify a different queue with options then the best >bet is to use the $SNDSMB system service for V3.x or the $SNDJBC system >service for V4.x (The $SNDSMB is being replaced). You should refer >to the "Record Managment Services" and "System Services" for details >on the different methods. > >Lib$spawn requires a CLI to do it's setup and therefore doesn't work >from a detached process. > >Ray The best way ??? For a macro programmer, perhaps !! What is wrong with fopen(file_spec, a_mode, ... "fop=spl"); or open(file_spec, flags, mode, ... "fop=spl"); Which opens the file for "spool on close". Of course, if the file did not yet exist, one can use "creat" with the same attribute. See PROGRAMMING IN VAX C (ordr # AA-L370B-TE) pages: 18-3 to 18-6 (create) 18-7 to 18-9 (open) 16-10 (fopen) Oz ------- Usenet: [decvax|allegra|linus|ihnp4]!utzoo!yetti!oz Bitnet: oz@[yusol|yuyetti] FREE SOFTWARE FOUNDATION vs. EMPIRE. Watch for things to come..
info-vax@ucbvax.UUCP (02/11/86)
In article <8602032142.AA02106@ia-sun2.uucp> you write: >I am trying to print a file "foo.bar" from C under VMS 3.6. >I have been successful at using LIB$SPAWN to spawn the command >"print foo.bar" BUT this will ONLY work with an interactive session. >It fails as a detached process and a batch job. I had originally >hoped that there would be a "print.exe" that I could use SYS$CREPRC >on but alas there is none. > >Could anyone give me pointers on how to print a file given a string >containing the file name and the appropriate options. It MUST >be able to run as either a batch job or a detached process. > > -David Robinson > ia-sun2!david@csvax.caltech.edu > seismo!cit-vax!ia-sun2!david This LIB$SPAWN silliness of only working interactively got fixed in VMS 4.1. Your code should work in a batch file just fine if you can get your system manager to convert to VMS 4.1 [Lots of other stuff will probably break though] tom campbell -- UUCP: 1st choice: allegra!scgvaxd!tcville!tc 2nd choice: {ucbvax | allegra | decvax }!sun!tsunami!tcville!tc MaBell: (213) 616-0237