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

Program Execution
HP COBOL Manual for TNS/E Programs520347-003
12-14
PARAM Command
To make use of the PRINTER-CONTROL parameter, the application program must
use a declarative procedure, preferably one of the form
USE AFTER STANDARD ERROR PROCEDURE ON CHEX
that responds only to errors on the printer file.
The procedure receives control when the operating environment detects the printer
problem. The procedure determines that the printer’s I-O status code is “30” and
handles the GUARDIAN-ERR values of 100 and 102. It might notify the operator of
which problem has occurred.
Although the record area still contains the record that was being written, there is no
way for the procedure to determine whether or not the record actually has been
written to the printer. For example, if “WRITE a-rec BEFORE ADVANCING PAGE”
was specified, perhaps the printer was off line before the write operation began, or
perhaps the record was written but the printer reached the end of the paper before
it could position to the top of a new sheet.
There is, however, a way to assure that the record does get written only once and
that any related control operations occur only once. The program must reissue
exactly the same form of the WRITE statement (same record name, same
ADVANCING clause, and so on). The run-time library does not repeat any control
function or system write request that successfully completed the first time, and re-
issues the control function or system write request that caused the status to occur,
plus any subsequent operations that were not completed.
One easy way to use this mechanism is to have the declarative respond to the
combination of I-O status code “30” and GUARDIAN-ERR value of 100 or 102 by
moving a FALSE value to a condition variable (associated to the condition-name
PRINT-OK) and conducting the dialog with the operator, then instead of coding just
a WRITE statement, code the sequence:
PERFORM UNTIL PRINT-OK
SET PRINT-OK TO TRUE
WRITE CHEX BEFORE ADVANCING 10
END-PERFORM
Additional Considerations
°
A parameter value that contains any embedded commas or leading or trailing
spaces must be enclosed in quotation marks. Between the delimiting quotation
marks, two consecutive quotation marks ("") represent any one quotation mark
(") that is part of the value. The delimiting quotation marks are not stored.
°
TACL provides internal storage for 1024 bytes of parameters. Each parameter
occupies a number of bytes equal to:
2 +
number-of-characters-in-parameter-name +
number-of-characters-in-parameter-value
°
Multiple PARAM name and value pairs must be delimited by commas.