Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing to a file in AIX

Status
Not open for further replies.

smaybo

IS-IT--Management
Jul 25, 2000
2
US
I have a client that uses a proprietary database system on a RS/6000 AIX system that has no exporting functions, but does have printing capabilities.&nbsp;&nbsp;I would like to use the system to run a report to a printer, but capture the output to a file.<br><br>I have some UNIX experience (although I have never needed to print to a file), but have never worked with AIX.<br><br>1. I don't even know what version of AIX they have.&nbsp;&nbsp;Is there a command to run to get this info (ie, something like the old dos 'ver' command) ??<br><br>2. How do I go about capturing the files sent to the printer?&nbsp;&nbsp;I understand that they probably go into a queue which the printer uses to get jobs and that if I turn the printer off the jobs will probably stay there.&nbsp;&nbsp;How can I find out where the queue directory is?&nbsp;&nbsp;Is each print job stored as a single file?<br><br>3. Once I find the file, what is the command to copy a file to the floppy drive.&nbsp;&nbsp;Their system has no internet access or NTFS access from a windows box so I am assuming that the only way I can get the file is to copy it to a disk.&nbsp;&nbsp;It should be small enough to fit on a single disk.&nbsp;&nbsp;Also...how does one format a floppy disk for use on AIX?<br><br>Thanks for any help you can provide...<br>STEVE<br><br>
 
Ok, to get the version of AIX you type<br>&quot;oslevel&quot; it should return something like &quot;4.3.2&quot;. To see what their print queue is type &quot;lpstat&quot; you will see a table with &quot;Queue, Dev, Status, job, Files, User, PP, %, Blks, Cp, Rnk&quot; for Queue, device, jobstatus, job#, file name, user id, pages, percent complete, # of blocks, # of copies, and Rank in queue.&nbsp;&nbsp;The word under &quot;queue&quot; will be the queue name and it belongs to the device (i.e., <A HREF="mailto:queuename@device.com">queuename@device.com</A>).&nbsp;&nbsp;To run your report and save it in a file and print it try: <b>{command for report}</b> &gt; <i>filename.out</i> ¦cat <i>filename.out</i> ¦<i>lp -d queuename</i>&nbsp;&nbsp;That should do it.<br><br>To copy the file to the floppy drive make sure the floppy is mounted &quot;mount /dev/fd0 /mnt/floppy&quot; and then just do &quot;cp filename.out /mnt/floppy&quot;. If the file is too big for the floppy try doing &quot;tar cvfz filename.out.tar filename.out&quot;. <p>Jon Zimmer<br><a href=mailto:b0rg@pcgeek.net>b0rg@pcgeek.net</a><br><a href= Aetea Information Technology</a><br>The software required `Windows 95 or better', so I installed Linux.<br>
 
Thanks for the note Jon.<br>This helps.&nbsp;&nbsp;One other question...<br><br>The report I am running is from within the database app they are using so I won't be running it from the command prompt.&nbsp;&nbsp;The program does allows me to select the printer/queue.<br><br>So lpstat tells me where that queue resides on the disk (like /var/spool/...) and what the print job's filename is (like job1234.out) ??<br>Thanks again...sorry to bug you.<br>STEVE<br>
 
Steve,<br><br>&nbsp;&nbsp;Well you got me on that one, if the outfile doesn't exist in /var/spool/... after the printjob is done I don't know where/how to get it.&nbsp;&nbsp;Have you looked for the file in /var/spool/?&nbsp;&nbsp;or maybe you could do a <i>find</i> like &quot;<i>find /var -name {filename.out} -print&quot;</i> will search for that file in /var.&nbsp;&nbsp;If you put &quot;/&quot; instead of &quot;/var&quot; it will look from the root directory down (if you're not root it will fail in some directories).&nbsp;&nbsp;Try that and tell me how it goes. <p>Jon Zimmer<br><a href=mailto:b0rg@pcgeek.net>b0rg@pcgeek.net</a><br><a href= Aetea Information Technology</a><br>The software required `Windows 95 or better', so I installed Linux.<br>
 
hi smaybo,<br><br>did this a while ago (trying to remember exactly how)<br><br>create a print queue - and (using smit) when it asks you for a device - put a filename there instead -- that's the easy way<br><br>slightly harder, needs some scripting skills....<br><br>make a named pipe (mkfifo) and specify that as the device - (easy so far)<br><br>write a shell script (in perl maybe, or just ksh) that will listen to the fifo and put the output somewhere you want. The shell script could be as simple as 'cat &lt; /u/myfifo &gt;/u/myoutputfile'<br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Hi,<br><br>Ok the best way as they told you is to create a queue to a file. This is done by using smit and creating a new print queue it will then ask you for a queue type, you select print to a file. The application will not be able to tell the difference between a normal printer and a file.<br>I am assuming the application prompts you for the queue, then you can specify the file queue device once to print to that file, and a printer Q device to print to that printer.<br><br>the directory is /var/spool/lpd/&lt;QUEUE_NAME&gt;/<br>but in order to capture those files you need a script to keep running and monitoring this directory. Not a smart way of doing this.<br><br>As for writing on a floppy, you can do it in two ways:<br>1- If your destination System is Win9x/Win2000/ OS/2, then you can use a utility in AIX called Dos utilitys<br>It comes with the AIX OS CD but is not installed by default.<br>To use it stick in the floppy and type:<br>#doswrite &lt;file_name&gt;<br>it will automatically assume that you want to write it on floppy. Not sure if it requires the floppy to be formatted in Dos, but do it just in case.<br><br>if the target is Unix based use:<br>cd to the directory where the file is(for better results)<br>#tar -cvf /dev/fd0 &lt;file_name&gt;<br>this will copy the file in tar format onto your floppy and this doesn't require any formating.<br>to untar it or extract it:<br>#tar -xvf /dev/fd0 &lt;file_name&gt;<br>this will copy the file to the current directory<br><br>Note that the doswritten files can also dosread, onto an AIX machine with the dos utilities installed.<br>using :<br>stick the floppy in,<br>#dosread &lt;file_name&gt;<br><br>N.B. <br>to know if Dos utils is installed use:<br>#lslpp -l ¦ grep dos<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top