Spooler Plus Programmer's Guide
Using the Spooler Interface Procedures
Spooler Plus Programmer’s Guide—522293-003
2-7
Summary of Spooling From an Application Program
Example of a Level-2 Application Program
You send data to the spooler at level 2 in 4 steps:
1. Open a file to a collector with the Guardian file-system OPEN procedure. This file
must be opened with waited I/O.
2. Call SPOOLSTART, passing the file number. You can specify the location, form
name, report name, number of copies, page size, and instructions on whether or
not to place the job in the HOLD state.
3. Send data to the spooler with calls to file-system procedures WRITE[X],
CONTROL, CONTROLBUF, and SETMODE. Each call to WRITE[X] is limited to
900 bytes or fewer.
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 #LLP LLP ",
! 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
! Open file to collector, and check for errors.
CALL OPEN( collector, collectnum);
IF <> THEN CALL error;
! Get a line of data and test for done.
! If done, fall through.
WHILE getline(line, length) DO
BEGIN
! Write the line to the collector and check for errors
CALL WRITE ( collectnum, line, length);
IF <> THEN CALL error;
END;
! Close the file to the collector and stop the program
CALL CLOSE(collectnum);
IF <> THEN CALL error;
CALL STOP;
END;
Example 2-1. Annotated Example of Level-1 Spooling (page 2 of 2)