Skip to content

Commit 18bc009

Browse files
authored
Add comments to CBL0001.cobol
Signed-off-by: klausmelcher <[email protected]>
1 parent 3bf38e9 commit 18bc009

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Labs/cbl/CBL0001.cobol

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
FILE-CONTROL.
1111
SELECT PRINT-LINE ASSIGN TO PRTLINE.
1212
SELECT ACCT-REC ASSIGN TO ACCTREC.
13+
*SELECT clause creates an internal file name
14+
*ASSIGN clause creates a name for an external data source,
15+
*which is associated with the JCL DDNAME used by the z/OS
16+
*e.g. ACCTREC is linked in JCL file CBL0001J to &SYSUID..DATA
17+
*where &SYSUID. stands for Your z/OS user id
18+
*e.g. if Your user id is Z54321,
19+
*the data set used for ACCTREC is Z54321.DATA
1320
*-------------
1421
DATA DIVISION.
1522
*-------------
@@ -19,15 +26,22 @@
1926
05 ACCT-NO-O PIC X(8).
2027
05 ACCT-LIMIT-O PIC $$,$$$,$$9.99.
2128
05 ACCT-BALANCE-O PIC $$,$$$,$$9.99.
29+
* PIC $$,$$$,$$9.99 -- Alternative for PIC on chapter 7.2.3,
30+
* using $ to allow values of different amounts of digits
31+
* and .99 instead of v99 to allow period display on output
2232
05 LAST-NAME-O PIC X(20).
2333
05 FIRST-NAME-O PIC X(15).
2434
05 COMMENTS-O PIC X(50).
35+
* since the level 05 is higher than level 01,
36+
* all variables belong to PRINT-REC (see chapter 7.3.3)
2537
*
2638
FD ACCT-REC RECORDING MODE F.
2739
01 ACCT-FIELDS.
2840
05 ACCT-NO PIC X(8).
2941
05 ACCT-LIMIT PIC S9(7)V99 COMP-3.
3042
05 ACCT-BALANCE PIC S9(7)V99 COMP-3.
43+
* PIC S9(7)v99 -- seven-digit plus a sign digit value
44+
* COMP-3 -- packed BCD (binary coded decimal) representation
3145
05 LAST-NAME PIC X(20).
3246
05 FIRST-NAME PIC X(15).
3347
05 CLIENT-ADDR.
@@ -49,6 +63,11 @@
4963
*
5064
READ-NEXT-RECORD.
5165
PERFORM READ-RECORD
66+
* The previous statement is needed before entering the loop.
67+
* Both the loop condition LASTREC = 'Y'
68+
* and the call to WRITE-RECORD depend on READ-RECORD having
69+
* been executed before.
70+
* The loop starts at the next line with PERFORM UNTIL
5271
PERFORM UNTIL LASTREC = 'Y'
5372
PERFORM WRITE-RECORD
5473
PERFORM READ-RECORD

0 commit comments

Comments
 (0)