Spooler Programmer's Guide
Using the Spooler Interface Procedures
Spooler Programmer’s Guide—522287-002
2-30
Spooling—Level 3
 sperrnum :=
 SPOOLSTART(collectnum, buffer, location,,,, 40, 
 %B0000000000110111);
 ! 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 buffer is ready to be written to collector
 ! call CHECKPOINT, then write buffer
 IF sperrnum = %11000 THEN
 BEGIN
 err := CHECKPOINT(line, buffer, bytecount,, collectnum);
 IF err THEN CALL cherror(err);
 sperrnum := SPOOLWRITE(buffer, line, length, bytecount);
 END;
 ! If there was an error from the first or second call to
 ! SPOOLWRITE, call sperror with the error code.
 IF sperrnum THEN CALL sperror(sperrnum);
 END;
 ! Call checkpoint before final write to collector by
 ! SPOOLEND
 err := CHECKPOINT(line, buffer, bytecount,,collectnum);
 IF err THEN CALL cherror(err);
 ! End this job and change the flag setting 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
 CALL CLOSE(collectnum);
 IF <> THEN CALL error;
 ! Stop backup and stop primary
 CALL cherror (0);
  CALL STOP;
 END;
Example 2-7. Annotated Example of Level-3 Spooling From a NonStop Process 
Pair With a Zero Sync Depth
(page4of4)










