cancel
Showing results for 
Search instead for 
Did you mean: 

besides using spool

Deanna Tran
Frequent Advisor

besides using spool

besides using spool to output txt file, is there anyway you can do this without using spool?
4 REPLIES
Deanna Tran
Frequent Advisor

Re: besides using spool

please ignore this question...perhaps, i would say how to create a flat file...
To create a flat file with SQL*Plus, you first must enter the following SET commands:


SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET MARKUP HTML OFF SPOOL OFF

After entering these commands, you use the SPOOL command as shown in the previous section to create the flat file.

I have found my answer...thank you

Bill Hassell
Honored Contributor

Re: besides using spool

Without knowing more about your printer connection and the type of data you are ending to the printer, it is very difficult to advise.

In the simplest method (but almost never used today), you connect the printer to a parallel port, then create the appropriate device file and use ux2dos to translate ASCII files on HP-UX and redirect the result to the device file.

If you use a serial connection, it becomes more complicated. After creating the appropriate serial device file, the default baud rate is 300 so you must keep one process running (like sleep) while redirecting sleep's input to the printer's device file and put it into the background. The use ux2dos to print ASCII files to the serial devicefile.

NOTE: parallel and serial connections have *NO* locking capability so if 2 or more users try to print on the printer, the text will interleaved and useless.

If the printer is connected to another computer, the complexity of sending the file with appropriate control commands is not worth the effort.

If the printer is connected to a non-HP LAN adapter, it will look exactly like another computer using rlp so the previous comments about remote printers will apply.

If the printer is connected to an HP JetDirect card and configured onto the network, the task is much simpler. First, download the latest HP Printer Installer software (free) from:

http://h20000.www2.hp.com/bizsupport/TechSupport/Product.jsp%3Flocale%3Den_US%26prodTypeId%3D13037%26prodSubCatId%3D28674

(sorry for the awful URL) Pick HP-UX 10.x or 11.x to match your system and install the software according to the instructions on the web site. To print a file, just use the hpnpf command as in:

/opt/hpnpl/bin/hpnpf -n -x 12.34.56.78 file_name

where 12.34.56.78 is the IP address of the printer and file_name is a plain ASCII file.

Now printing with controls (like landscape or duplex) is a bit more complicated. You'll first need a technical reference manual for the printer, then find the special escape sequences needed to change the printer's features. Then you'll have to prepend these sequences prior to each job, and also add reset sequences after each job to return the printer to a known state.

Or you can use the lp spooler (which is a whole lot easier).


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: besides using spool

Ahhhh, SQL, not Unix. You can ignore my answer.


Bill Hassell, sysadmin
Brian Crabtree
Honored Contributor

Re: besides using spool

You also have the option of using the utl_file package to output information to a file as well. This can be done inside of a sql program, like a procedure, where the "spool" command will not work.

Brian