beautypg.com

7 modes for printing reports – Compaq COBOL AAQ2G1FTK User Manual

Page 323

background image

Producing Printed Reports

10.6 Programming a Linage-File Compaq COBOL Report

Example 10–5 (Cont.) Programming a 20-Line Logical Page Defined by the

LINAGE Clause with Automatic Page Overflow

A100-READ-INPUT.

READ INPUT-FILE AT END MOVE "Y" TO END-OF-FILE.
IF END-OF-FILE NOT = "Y"

PERFORM A200-PRINT-REPORT.

A200-PRINT-REPORT.

MOVE I-LAST

TO MINIF1-LAST.

WRITE MINIF1-PRINT-LINE FROM MINIF1-LINE-3 BEFORE ADVANCING 1 LINE.
MOVE SPACES TO MINIF1-PRINT-LINE.
WRITE MINIF1-PRINT-LINE AFTER ADVANCING 9 LINES.
MOVE I-NAME

TO MINIF1-NAME.

WRITE MINIF1-PRINT-LINE FROM MINIF1-LINE-13 BEFORE ADVANCING 1 LINE.
MOVE I-STREET

TO MINIF1-STREET.

WRITE MINIF1-PRINT-LINE FROM MINIF1-LINE-14 BEFORE ADVANCING 1 LINE.
MOVE I-CITY

TO MINIF1-CITY.

MOVE I-STATE

TO MINIF1-STATE.

MOVE I-ZIP

TO MINIF1-ZIP.

WRITE MINIF1-PRINT-LINE FROM MINIF1-LINE-15 BEFORE ADVANCING 1 LINE.

A300-FORM-LINE-UP.

MOVE ALL "X" TO INPUT-RECORD.
PERFORM A200-PRINT-REPORT 3 TIMES.
DISPLAY "Is Alignment OK? (Y/N): " WITH NO ADVANCING.
ACCEPT LINE-UP-OK.

10.7 Modes for Printing Reports

Either your Compaq COBOL program can allocate a printer directly and
immediately produce the report, or it can spool the report to a mass storage
device for printing later. Section 10.7.1 and Section 10.7.2 describe these two
modes of printing. Note that spooling the report to a mass storage device makes
better use of system resources than allocating a printer directly.

10.7.1 Directly Allocating a Printer

To directly allocate a printer, your Compaq COBOL program must include the
printer’s device name in the file specification for the report file.

On OpenVMS, for example:

SELECT REPORT-FILE ASSIGN TO "LP:".

Directly allocating the printer has the following advantages:

Results are immediate.

Numbers on a preprinted form are associated with a record in a file (as in the
case of payroll checks). For example, as the operator opens each box of forms
and mounts them in the printer (or remounts them if a paper jam occurs),
your program can request and accept the starting number from each new
box of forms. If the program then outputs a record for each printed form and
includes the form number in the record, you establish an immediate audit
trail.

Directly allocating the printer has the following disadvantages:

Either you must wait until all printer requests from the system spooler are
completed, or you must change job priorities.

Producing Printed Reports 10–23