COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Example 296 Level-1 Spooling
SELECT SPOOLER-FILE
ASSIGN TO "$S.#MYSTUF"
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL....
FD SPOOLER-FILE
RECORD CONTAINS 80 TO 132 CHARACTERS
LABEL RECORDS ARE OMITTED.
01 SPOOLER-SHORT-LINE PIC X(80).
01 SPOOLER-LONG-LINE PIC X(132)....
PROCEDURE DIVISION....
OPEN OUTPUT SPOOLER-FILE...
WRITE SPOOLER-SHORT-LINE...
Level-2 Spooling
You use level-2 spooling the way you use level-1 spooling, except that instead of opening the
output file with the OPEN statement, you open it with the routine COBOL_SPECIAL_OPEN_ , giving
the first parameter, open-type, the value 1, and either omitting the parameter level-3 or giving it
the value 0.
The other parameters of the COBOL_SPECIAL_OPEN_ routine enable you can specify:
Exclusion mode
Sync depth
Whether a page-eject precedes the first page printed
Location name
Form name
Report name
Number of copies
Page size
Flags that set the job priority and the attributes HOLD and HOLDAFTER
Owner
Maximum number of lines
Maximum number of pages
Whether to create a regular or code-129 spooler file
Whether a form feed is to be used to position the file at the top of a new page rather than
using spacing when LINAGE is specified for the file
An error return code
For details, see COBOL_SPECIAL_OPEN_ (page 636).
The preferred way to apply a declarative to a file that is used for level-2 spooling is to explicitly
name the file in a USE AFTER EXCEPTION statement. All ordinary HP COBOL file-manipulating
statements then transfer control to the declarative if an exception arises. The statement ENTER
COBOL_SPECIAL_OPEN_ (in the CRE environment) does not transfer control if it encounters an
exception, so include a GIVING phrase in the ENTER statement and then test the file status code
data item after the ENTER statement executes.
Example 297 uses level-2 spooling in the non-CRE environment. In the CRE, use
COBOL_SPECIAL_OPEN_ instead of COBOL85^SPECIAL^OPEN.
904 Printer and Spooler Output