Spooler Plus Programmer's Guide

Using the Spooler Interface Procedures
Spooler Plus Programmers Guide522293-003
2-9
Summary of Spooling From an Application Program
?nolist
INT counter := 0;
?SOURCE $SYSTEM.SYSTEM.EXTDECS(OPEN, CLOSE, WRITE, STOP,
?SPOOLSTART)
PROC error;
BEGIN
CALL STOP;
END;
PROC sperror (errnum);
INT errnum;
BEGIN
CALL STOP;
END;
INT PROC getline( line, length);
INT .line,
.length;
BEGIN
int temp, done;
temp :=0;
temp := counter.<13:15> ;
temp := temp * 5;
line [0] ':=' " ";
line [1] ':=' line[0] for 39;
line [temp] ':=' "0123456789";
length := 80;
IF counter > 120 THEN done := 0 ELSE done := 1;
counter := counter + 1;
RETURN done;
END;
?list
PROC root MAIN;
BEGIN
! Declarations
INT collector [0:11] := "$S #LP3 LP3 ",
! contains the collector and location name in internal
! format
line [0:39],
! contains the line of data to spool
length,
! contains the number of bytes to write from line
collectnum,
! contains the collector's file number returned from OPEN
location [0:7] := "#LPRMT3 ",
! contains the job's new location
sperrnum;
! receives SPOOLSTART error code
Example 2-2. Annotated Example of Level-2 Spooling (page 2 of 3)