# assignfq (UNIX) command

The assignfq command assigns a printer
device driver to a spooler form queue. This printer driver is then
used by the Output processor, or by FlashBASIC @() functions to generate special formatting commands such as boldface,
cursor positioning, or underlining, when output is directed to the
spooler.

Using a ? as a parameter produces abbreviated
TCL help. Multiple form queues can be updated in the command, but
each queue must have an associated device name. Printer drivers are
located in the dm,devices, file. The current driver assignments may
be displayed with the listabs command. A printer
may have more than one form queue attached to it.

On UNIX-based
implementations, the spooler has the ability to transfer data directly
from the D3 process to a UNIX-based operation such as a spooler, file,
communications link, hardware device, and so on.

The relationship
between D3 and the UNIX process is established by the assignfq command. Place the UNIX command string in parentheses immediately
after the device name field. The assignfq command
recognizes the parentheses to mean a UNIX process and sets up the
proper linkages.

## Syntax

```
assignfq form.queue{-n},device.name{(unix.command)}
{,form.queue,device.name{(unix.command)} {,...}} {(options}
assignfq ?
```

## Parameter(s)

| form.queue | Spooler form queue to which the specified device driver is being assigned. | |
| --- | --- | --- |
| device.name | Name of the device to assign to the specified form queue. If "null" is specified, unassigns a device from the specified form queue. | |
| options | c | (optional) Compiles the devices file item into the printer control block. |
The printer control block is a binary item, (similar to
a system-level dynamic array) that contains the codes and control
strings pertinent to the device in question. Each system function
( @(-n) ) has its own array position, and the system
cursor function searches this item for control strings such as clear-screen,
clear to end of screen, and so on.

Warning: The changes
created by an assignfq function do not take effect
for a given line until an sp-assign command is
executed on that line. It is recommended that all assignfq commands be incorporated into the system’s coldstart macros so that
they are automatically set up when the machine boots. Direct-to-UNIX
spooling is only available on UNIX systems. The BREAK key must not
be pressed while spooling a job directly to a UNIX process as the
UNIX child process will receive a SIGKILL, causing termination of
the spool output. Since direct-to-UNIX spooling goes directly out
to a UNIX command, the sp-assign options o, h, i, d, c and t are ignored. The a and s options still work in this situation.
When printing to UNIX, all output is buffered through UNIX pipes.
Output may not actually enter the UNIX command until the D3 process
has closed the job or returned to TCL, at which time D3 closes the
pipe, forcing UNIX to flush the buffer.

## Example(s)

```
assignfq 3,hp-lzrii
```
The example above assigns driver hp-lzrii to form queue
3.

```
assignfq 3,hp-lzrii(cat>/file1)
sp-assign f3?
Line# Status Copies Form# Device
7 p 1 3 hp-lzrii(cat>/file1)
list only md (p
```
The above assignfq command establishes a relationship between the D3 spooler form queue
3 and the UNIX process cat > /file1. Then, the sp-assign command tells the system to attach to form queue 3. Note that the sp-assign is necessary even if the line is already assigned
to form queue 3 so that the process is informed that form queue 3
should now output to a UNIX command. Finally, the list command creates the UNIX file /file1 with an image of the listing.

The FlashBASIC program below creates a UNIX file containing the
text line 1.

```
execute "assignfq 0,ibm3151(cat>/file1)"
execute "sp-assign f0"
execute "!rm /file1"; * Clear old one out
printer on; * Start printer output
print "line 1"
execute "!ls -l /file1"
printer close; * Close output
execute "!ls -l /file1"
execute "!cat /file1"
```
The output of the program is:

```
Assigned form queue device 0, IBM3151(cat>/file1)
-rw-rw---- 1 pick pick 0 Apr 23 11:15 /file1
-rw-rw---- 1 pick pick 7 Apr 23 11:15 /file1
line 1
```
Special attention must be paid to the size of the UNIX
file. Note the size printed on the UNIX ls command (0 and then 7).
Even after the line 1 text has been printed, the UNIX file size is
still 0. Only after the print file has been closed does the output
display in that file (as shown by the new size of 7). Because of this
buffering effect, printer jobs must be closed before examining the
UNIX output.

## See also

- [devices file](https://d3codex.com/systemfiles/devices-file/)

---
Source: https://d3codex.com/tcl/assignfq-unix-command/ - part of the D3Codex reference.
