Here is the code for the subprogram ERROROUT, which will be called dynamically by the main program in Assignment 6.
This is provided just in case anyone is curious.
ERROROUT was compiled using the compiler options 'FLAG(I,I),APOST,TEST' and linked using the linkage editor options 'MAP,REUS=SERIAL'.
Identification Division.
Program-ID. ERROROUT.
Author. Harry Hutchins.
Date-Compiled. Supplied by the system.
****************************************************************
* *
* Program Name: ERROROUT. *
* *
* Function: This program accepts a message, puts *
* it on a detail line, and prints it. *
* The first line is an unnumbered page *
* heading and the rest are numbered. *
* *
* Input: None. *
* *
* Output: A printed report. *
* *
* Entry Conditions: The program receives one argument, a *
* 120-byte character string. *
* *
* Exit Conditions: The return code is always 0. *
* *
****************************************************************
Environment Division.
Configuration Section.
Source-Computer. IBM-390.
Object-Computer. IBM-390.
Input-Output Section.
File-Control.
Select Print-File Assign To ERRORS.
Eject
Data Division.
File Section.
****************************************************************
* *
* Print-File. *
* *
****************************************************************
FD Print-File
Recording Mode is F.
01 Print-Record Pic X(132).
Working-Storage Section.
****************************************************************
* *
* Variable Dictionary *
* *
* Open-Flag This is a flag for whether *
* Print-File is open. *
* *
* Line-Count Counter for lines printed, other *
* than the page heading line. *
* *
* Detail-Line Line to be printed. *
* *
****************************************************************
01 Open-Flag Pic X Value 'N'.
01 Line-Count Pic 99 Comp-3 Value 0.
01 Detail-Line.
05 Pic X(2) Value Spaces.
05 D-Line-Num Pic ZZ.
05 D-Period Pic X.
05 Pic X(1) Value Spaces.
05 D-Data Pic X(120) Value Spaces.
05 Pic X(6) Value Spaces.
Linkage Section.
****************************************************************
* *
* Linkage Section Dictionary *
* *
* Parm-Line Message to be printed. *
* *
****************************************************************
01 Parm-Line Pic X(120).
Eject
Procedure Division Using Parm-Line.
****************************************************************
* *
* 000-Main. *
* *
****************************************************************
000-Main.
If Open-Flag = 'N'
Open Output Print-File
Move 'Y' to Open-Flag
End-If.
If Parm-Line = Spaces
Close Print-File
Else
Move Parm-Line to D-Data
If Line-Count = 0
Move 0 to D-Line-Num
Move ' ' to D-Period
Write Print-Record from Detail-Line
after Advancing Page
Move Spaces to Print-Record
Write Print-Record
Add 1 to Line-Count
Else
Move Line-Count to D-Line-Num
Move '.' to D-Period
Write Print-Record from Detail-Line
after Advancing 3 lines
Add 1 to Line-Count
End-If
End-If.
Move 0 to Return-Code.
GoBack.