Spooler Plus Programmer's Guide

Using the Spooler Interface Procedures
Spooler Plus Programmers Guide522293-003
2-13
Summary of Spooling From an Application Program
CALL OPEN( collector, collectnum);
IF <> THEN CALL error;
! Call SPOOLSTART to specify new job attributes
! location #LPRMT3
! form name blanks (default)
! report name user's name and group name (default)
! number of copies 1 (default)
! page size 40
! flags
! hold off
! holdafter on
! NonStop bit off
! priority 7
sperrnum :=
SPOOLSTART(collectnum, buffer, location,,,, 40,
%B0000000000100111);
! Test for an error from SPOOLSTART
If sperrnum THEN CALL sperror(sperrnum);
! Get a line of data and test for done.
! If done, fall through.
WHILE getline(line, length) DO
BEGIN
! Write line to collector and check for errors
sperrnum := SPOOLWRITE (buffer, line, length);
IF sperrnum THEN CALL sperror(sperrnum);
END;
! End this job and change the flag settings to
! flags
! cancel off
! hold on
! holdafter off
! NonStop bit off
! priority 4
sperrnum := SPOOLEND(buffer, %B0000000001000100);
IF sperrnum THEN CALL sperror(sperrnum);
! Close the file to the collector and stop the program
CALL CLOSE(collectnum);
IF <> THEN CALL error;
CALL STOP;
END;
Example 2-3. Annotated Example of Level-3 Spooling (page 3 of 3)