COBOL Manual for TNS and TNS/R Programs

Printer and Spooler Output
HP COBOL Manual for TNS and TNS/R Programs522555-006
30-9
Spooling Program Output
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
COBOL85^SPECIAL^OPEN (in the non-CRE environment) or
COBOL_SPECIAL_OPEN_ (in the CRE), 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 COBOL85^SPECIAL^OPEN or
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 COBOL85^SPECIAL^OPEN and COBOL_SPECIAL_OPEN_
.
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 “COBOL85^SPECIAL^OPEN” (in the non-
CRE environment) or ENTER COBOL_SPECIAL_OPEN_ (in the CRE) 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 30-2 uses level-2 spooling in the non-CRE environment. In the CRE, use
COBOL_SPECIAL_OPEN_ instead of COBOL85^SPECIAL^OPEN.