Skip to content

Commit bf2055d

Browse files
klausmelcherbinary-sequence
authored andcommitted
add comments
Signed-off-by: klausmelcher <[email protected]>
1 parent 4489964 commit bf2055d

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

Labs/cbl/PAYROL00.cobol

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,50 @@
1-
*A B
1+
* COBOL reference format (Figure 1., page 32)
2+
*Columns:
3+
* 1 2 3 4 5 6 7
4+
*89012345678901234567890123456789012345678901234567890123456789012
5+
*<A-><--------------------------B-------------------------------->
6+
*Area Area
7+
*<---Sequence Number Area Identification Area---->
8+
*-----------------------
29
IDENTIFICATION DIVISION.
10+
*-----------------------
311
PROGRAM-ID. PAYROL00.
12+
*-------------
413
DATA DIVISION.
14+
*-------------
515
WORKING-STORAGE SECTION.
616
****** Variables for the report
17+
* level number
18+
* | variable name
19+
* | | picture clause
20+
* | | |
21+
* V V V
722
77 WHO PIC X(15).
823
77 WHERE PIC X(20).
924
77 WHY PIC X(30).
1025
77 RATE PIC 9(3).
1126
77 HOURS PIC 9(3).
1227
77 GROSS-PAY PIC 9(5).
1328

29+
* PIC X(15) -- fiftheen alphanumeric characters
30+
* PIC 9(3) -- three-digit value
31+
*------------------
1432
PROCEDURE DIVISION.
33+
*------------------
1534
****** COBOL MOVE statements - Literal Text to Variables
1635
MOVE "Captain COBOL" TO WHO.
1736
MOVE "San Jose, California" TO WHERE.
1837
MOVE "Learn to be a COBOL expert" TO WHY.
1938
MOVE 19 TO HOURS.
2039
MOVE 23 TO RATE.
40+
* The string "Captain COBOL" only contains 13 characters,
41+
* the remaining positions of variable WHO are filled with spaces
42+
* The value 19 only needs 2 digits,
43+
* the leftmost position of variable HOURS is filled with zero
2144
****** Calculation using COMPUTE reserved word verb
2245
COMPUTE GROSS-PAY = HOURS * RATE.
46+
* The result of the multiplication only needs 3 digits,
47+
* the remaining leftmost positions are filled with zeroes
2348
****** DISPLAY statements
2449
DISPLAY "Name: " WHO.
2550
DISPLAY "Location: " WHERE

0 commit comments

Comments
 (0)