Spooler Plus Programmer's Guide
Using the Spooler Interface Procedures
Spooler Plus Programmer’s Guide—522293-003
2-14
COBOL Spooling
COBOL Spooling
Programs written in COBOL can spool their data at level 2 or 3 in the same manner as 
a TAL program. COBOL users typically use the spooling facilities provided by COBOL. 
See the COBOL85 Manual for more information.
COBOL Spooling—Level 1
Level-1 spooling from COBOL is not supported.
COBOL Spooling—Levels 2 and 3
To spool from COBOL, use one of the COBOL utility routines: 
COBOLSPOOLOPEN permits level-2 spooling for COBOL users.
COBOL85^SPECIAL^OPEN permits level-2 or level-3 spooling for COBOL85 
users.
COBOL_SPECIAL_OPEN permits level-2 or level-3 spooling.
Use any of the above procedures to perform both the OPEN and SPOOLSTART 
operations. Following the OPEN, write the data to the collector as follows: 
1. Using a SELECT statement, assign a COBOL file descriptor name to the process 
name of the collector. For example, if $SPL is a collector, the Input-Output Section 
of the Environment Division would contain the statement:
SELECT SPOOLER ASSIGN "$SPL".
2. In the File Section of the Data Division, use a file definition (FD) to specify the 
record to be associated with writes to the spooler:
FD SPOOLER RECORD CONTAINS 80 CHARACTERS LABEL RECORDS ARE 
OMITTED. 01 SPOOL-LINE PIC X(80).
3. In the Procedure Division, open the spooler as the output file:
OPEN OUTPUT SPOOLER.
4. Write each line of data to the spooler. For example, if the data to be spooled is in 
DATA-LINE, the WRITE statement for the above FD would look like the following:
WRITE SPOOL-LINE FROM DATA-LINE.
Example 2-4 is an example of a program that performs COBOL spooling. A 
specification in the Working Storage Section determines whether level-2 or level-3 
spooling is used. 










