Skip to content

Commit 4493699

Browse files
committed
Add comments to CBL0008 and CBL0009
Signed-off-by: klausmelcher <[email protected]>
1 parent fc8b4d7 commit 4493699

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

COBOL Programming Course #1 - Getting Started/Labs/cbl/CBL0008.cobol

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
01 TLIMIT-TBALANCE.
4747
05 TLIMIT PIC S9(9)V99 COMP-3 VALUE ZERO.
4848
05 TBALANCE PIC S9(9)V99 COMP-3 VALUE ZERO.
49+
* TLIMIT -- variable for total of all client's
50+
* bank account limits.
51+
* TBALANCE -- variable for total of all client's
52+
* bank account balances.
53+
* The PIC Clause S9 allows representation of positive and
54+
* negative balances. Using PIC Clause $$$,$$$,$$9.99
55+
* only a positive total balance could be displayed .
4956
*
5057
01 HEADER-1.
5158
05 FILLER PIC X(20) VALUE 'Financial Report for'.
@@ -97,6 +104,8 @@
97104
05 FILLER PIC X(01) VALUE SPACES.
98105
05 TBALANCE-O PIC $$$,$$$,$$9.99.
99106
05 FILLER PIC X(40) VALUE SPACES.
107+
* Just like HEADER, TRAILER formats the report for
108+
* total client account limit and balance
100109
*
101110
01 WS-CURRENT-DATE-DATA.
102111
05 WS-CURRENT-DATE.
@@ -137,6 +146,7 @@
137146
PERFORM READ-RECORD
138147
END-PERFORM
139148
.
149+
*
140150
WRITE-TLIMIT-TBALANCE.
141151
MOVE TLIMIT TO TLIMIT-O.
142152
MOVE TBALANCE TO TBALANCE-O.
@@ -152,11 +162,25 @@
152162
READ ACCT-REC
153163
AT END MOVE 'Y' TO LASTREC
154164
END-READ.
165+
*
166+
* The LIMIT-BALANCE-TOTAL paragraph performs an arithmetic
167+
* statement for each client through the loop,
168+
* in order to calculate the final limit and balance report.
155169
*
156170
LIMIT-BALANCE-TOTAL.
157171
COMPUTE TLIMIT = TLIMIT + ACCT-LIMIT END-COMPUTE
158172
COMPUTE TBALANCE = TBALANCE + ACCT-BALANCE END-COMPUTE
159173
.
174+
* The COMPUTE verb assigns the value of the arithmetic
175+
* expression to the TLIMIT and TBALANCE data items.
176+
* Since the expression only includes an addition operation,
177+
* the statements can also be written as:
178+
* ADD ACCT-LIMIT TO TLIMIT.
179+
* ADD ACCT-BALANCE TO TBALANCE.
180+
* Or, alternatively specifying the target variable:
181+
* ADD ACCT-LIMIT TO TLIMIT GIVING TLIMIT.
182+
* ADD ACCT-BALANCE TO TBALANCE GIVING TLIMIT.
183+
* A END-COMPUTE or END-ADD stetement is optional.
160184
*
161185
WRITE-RECORD.
162186
MOVE ACCT-NO TO ACCT-NO-O.

COBOL Programming Course #1 - Getting Started/Labs/cbl/CBL0009.cobol

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
01 TLIMIT-TBALANCE.
4747
05 TLIMITED PIC S9(9)V99 COMP-3 VALUE ZERO.
4848
05 TBALANCE PIC S9(9)V99 COMP-3 VALUE ZERO.
49+
* TLIMITED -- variable for total of all client's
50+
* bank account limits.
51+
* TBALANCE -- variable for total of all client's
52+
* bank account balances.
53+
* The PIC Clause S9 allows representation of positive and
54+
* negative balances. Using PIC Clause $$$,$$$,$$9.99
55+
* only a positive total balance could be displayed .
4956
*
5057
01 HEADER-1.
5158
05 FILLER PIC X(20) VALUE 'Financial Report for'.
@@ -97,6 +104,8 @@
97104
05 FILLER PIC X(01) VALUE SPACES.
98105
05 TBALANCE-O PIC $$$,$$$,$$9.99.
99106
05 FILLER PIC X(40) VALUE SPACES.
107+
* Just like HEADER, TRAILER formats the report for
108+
* total client account limit and balance
100109
*
101110
01 WS-CURRENT-DATE-DATA.
102111
05 WS-CURRENT-DATE.
@@ -137,6 +146,7 @@
137146
PERFORM READ-RECORD
138147
END-PERFORM
139148
.
149+
*
140150
WRITE-TLIMIT-TBALANCE.
141151
MOVE TLIMIT TO TLIMIT-O.
142152
MOVE TBALANCE TO TBALANCE-O.
@@ -152,11 +162,25 @@
152162
READ ACCT-REC
153163
AT END MOVE 'Y' TO LASTREC
154164
END-READ.
165+
*
166+
* The LIMIT-BALANCE-TOTAL paragraph performs an arithmetic
167+
* statement for each client through the loop,
168+
* in order to calculate the final limit and balance report.
155169
*
156170
LIMIT-BALANCE-TOTAL.
157171
COMPUTE TLIMIT = TLIMIT + ACCT-LIMIT END-COMPUTE
158172
COMPUTE TBALANCE = TBALANCE + ACCT-BALANCE END-COMPUTE
159173
.
174+
* The COMPUTE verb assigns the value of the arithmetic
175+
* expression to the TLIMIT and TBALANCE data items.
176+
* Since the expression only includes an addition operation,
177+
* the statements can also be written as:
178+
* ADD ACCT-LIMIT TO TLIMIT.
179+
* ADD ACCT-BALANCE TO TBALANCE.
180+
* Or, alternatively specifying the target variable:
181+
* ADD ACCT-LIMIT TO TLIMIT GIVING TLIMIT.
182+
* ADD ACCT-BALANCE TO TBALANCE GIVING TLIMIT.
183+
* A END-COMPUTE or END-ADD stetement is optional.
160184
*
161185
WRITE-RECORD.
162186
MOVE ACCT-NO TO ACCT-NO-O.

0 commit comments

Comments
 (0)