Despools print jobs to a printer or terminal attached to your current port.
The PORT-DESPOOL command is a synonym for the PORTOUT command.
First create a formqueue with a Device Type of 'PORT'. For this example we
will assume the name of the form queue is 'SCREEN'. There are 2 ways to accomplish this:
1. From Option 1 on the SP-STATUS menu. When
prompted enter
SCREEN PORT
2. Or from the jShell command line type:
SP-CREATE SCREEN PORT
Note: In both cases, press <Enter> when you are prompted for 'Device
Name'.
Now assign this queue using the SP-ASSIGN
command, e.g.
SP-ASSIGN = SCREEN
At this point you are now ready to create a print job. For this example,
simply type
LIST . (P
which will send the contents of the current directory to the spooler,
specifically to the form queue SCREEN.
Finally you can now despool this job with
PORT-DESPOOL SCREEN (X
Note that the spooler assignment (SP-ASSIGN = SCREEN) will remain in effect
until you execute another SP-ASSIGN or you terminate the current connection to
jBASE.
A common use for this is to send spooled output through the 'aux' (serial) port
of a local pc to a 'slave' printer. The trouble is that 'slave-on' and
'slave-off' sequences are not generated automatically. Not to worry though,
jBASE has a solution. To 'auto generate' slave-on/slave-off sequences you need
to defined these in a spooler form-type that is assigned to the form queue.
Continuing with our example of using the form queue SCREEN:
First, assign a form-type with defines STARTJOB and ENDJOB. STARTJOB will
send a 'slave on' message at the start of each job and ENDJOB will send a
'slave off' message. For these two actions you need to create two jBC programs
called 'slave_on' and 'slave_off' respectively:
PROGRAM slave_on
PRINT @(-17):
PROGRAM slave_off
PRINT @(-18):
Now compile and catalog these two programs, and ensure they can be
seen from the PATH environment variable.
Next create the new form-type by copying the 'jspform_deflt' file to a new
name. This file is located in %JBCRELEASEDIR%\config directory. For example, on
Windows, at a jShell prompt type:
COPY C:\JBASE30\config jspform_deflt
TO: jspform_port
This assumes that jBASE was installed in the default location on Windows. A similar command on unix might be:
COPY /usr/jbc/config jspform_deflt
TO: jspform_port
Edit the new 'jspform_port' file, locate the STARTJOB and ENDJOB commands and enter the following two lines:
STARTJOB slave_on
ENDJOB slave_off
[Note: Other form-type settings you might want to set at this time are WIDTH
and DEPTH so that you do not have to issue these as TERM commands.]
Finally, assign the new form-type to the SCREEN form queue by enter the following command at a jShell command prompt:
SP-TYPE SCREEN port
We're now ready to test this with the PORT-DESPOOL command...
SP-ASSIGN = SCREEN
LIST . LPTR
PORT-DESPOOL (XL
[Note: When issuing a PORT-DESPOOL command under BASIC control, do NOT
'capture' the output as this will not allow the job to be despooled.]