|
15 | 15 | *------------- |
16 | 16 | FILE SECTION. |
17 | 17 | FD PRINT-LINE RECORDING MODE F. |
| 18 | + *FD -- describes the layout of PRINT-LINE file, |
| 19 | + *including level numbers, variable names, data types and lengths |
| 20 | + * |
18 | 21 | 01 PRINT-REC. |
19 | 22 | 05 ACCT-NO-O PIC X(8). |
20 | 23 | 05 FILLER PIC X(02) VALUE SPACES. |
| 24 | + * FILLER -- COBOL reserved word used as data name to remove |
| 25 | + * the need of variable names only for inserting spaces |
| 26 | + * |
21 | 27 | 05 LAST-NAME-O PIC X(20). |
22 | 28 | 05 FILLER PIC X(02) VALUE SPACES. |
| 29 | + * SPACES -- used for structured spacing data outputs rather |
| 30 | + * than using a higher PIC Clause length as in CBL0001.cobol, |
| 31 | + * which makes a good design practice and a legible output |
| 32 | + * |
23 | 33 | 05 ACCT-LIMIT-O PIC ZZ,ZZZ,ZZ9.99. |
| 34 | + * PIC ZZ,ZZZ,ZZ9.99 -- allows values of different amounts of |
| 35 | + * digits do be input, replacing zeros with spaces |
| 36 | + * |
24 | 37 | 05 FILLER PIC X(02) VALUE SPACES. |
25 | 38 | 05 ACCT-BALANCE-O PIC ZZ,ZZZ,ZZ9.99. |
26 | 39 | 05 FILLER PIC X(02) VALUE SPACES. |
27 | | - * |
28 | 40 | FD ACCT-REC RECORDING MODE F. |
29 | 41 | 01 ACCT-FIELDS. |
30 | 42 | 05 ACCT-NO PIC X(8). |
|
41 | 53 | * |
42 | 54 | WORKING-STORAGE SECTION. |
43 | 55 | 01 FLAGS. |
44 | | - 05 LASTREC PIC X VALUE SPACE. |
| 56 | + 05 LASTREC PIC X VALUE SPACE. |
45 | 57 | * |
46 | 58 | 01 HEADER-1. |
47 | 59 | 05 FILLER PIC X(20) VALUE 'Financial Report for'. |
|
77 | 89 | 05 FILLER PIC X(02) VALUE SPACES. |
78 | 90 | 05 FILLER PIC X(13) VALUE '-------------'. |
79 | 91 | 05 FILLER PIC X(40) VALUE SPACES. |
| 92 | + * |
| 93 | + *HEADER -- structures for report or column headers, |
| 94 | + *that need to be setup in WORKING-STORAGE so they can be used |
| 95 | + *in the PROCEDURE DIVISION |
80 | 96 | * |
81 | 97 | 01 WS-CURRENT-DATE-DATA. |
82 | 98 | 05 WS-CURRENT-DATE. |
|
94 | 110 | OPEN-FILES. |
95 | 111 | OPEN INPUT ACCT-REC. |
96 | 112 | OPEN OUTPUT PRINT-LINE. |
| 113 | + OPEN-FILES-END. |
| 114 | + *OPEN-FILES-END -- consists of an empty paragraph suffixed by |
| 115 | + *-END that ends the past one and serves as a visual delimiter |
97 | 116 | * |
98 | 117 | WRITE-HEADERS. |
99 | 118 | MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-DATA. |
|
110 | 129 | * |
111 | 130 | READ-NEXT-RECORD. |
112 | 131 | PERFORM READ-RECORD |
| 132 | + * PERFORM -- in this case transfers control to another |
| 133 | + * paragraph of the code, executes it and returns control to |
| 134 | + * the following line. |
| 135 | + * |
113 | 136 | PERFORM UNTIL LASTREC = 'Y' |
| 137 | + * here PERFORM allows a loops to be entered |
| 138 | + * |
114 | 139 | PERFORM WRITE-RECORD |
115 | 140 | PERFORM READ-RECORD |
116 | 141 | END-PERFORM |
117 | | - . |
| 142 | + . |
118 | 143 | * |
119 | 144 | CLOSE-STOP. |
120 | 145 | CLOSE ACCT-REC. |
|
0 commit comments