Skip to content

Commit d457945

Browse files
authored
Merge branch 'master' into challenges-fmt
2 parents 621753b + 5b9c035 commit d457945

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
41.1 KB
Loading

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
10 WS-CURRENT-MINUTE PIC 9(02).
9595
10 WS-CURRENT-SECOND PIC 9(02).
9696
10 WS-CURRENT-MILLISECONDS PIC 9(02).
97+
* This data layout is organized according to the ouput
98+
* format of the FUNCTION CURRENT-DATE.
9799
*
98100
*------------------
99101
PROCEDURE DIVISION.
@@ -104,6 +106,10 @@
104106
*
105107
WRITE-HEADERS.
106108
MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-DATA.
109+
* The CURRENT-DATE function returns an alphanumeric value
110+
* that represents the calendar date and time of day
111+
* provided by the system on which the function is
112+
* evaluated.
107113
MOVE WS-CURRENT-YEAR TO HDR-YR.
108114
MOVE WS-CURRENT-MONTH TO HDR-MO.
109115
MOVE WS-CURRENT-DAY TO HDR-DAY.
@@ -139,6 +145,11 @@
139145
IF USA-STATE = 'Virginia' THEN
140146
ADD 1 TO VIRGINIA-CLIENTS
141147
END-IF.
148+
* Boolean logic -- when the conditional expression
149+
* USA-STATE = 'Virginia' is true, the program
150+
* counts one more client from Virginia
151+
* Note -- the inclusion of the word THEN is optional
152+
* END-IF -- explicitly terminates the IF statement
142153
*
143154
WRITE-RECORD.
144155
MOVE ACCT-NO TO ACCT-NO-O.

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
10 STREET-ADDR PIC X(25).
3737
10 CITY-COUNTY PIC X(20).
3838
10 USA-STATE PIC X(15).
39+
88 STATE VALUE 'Virginia'.
40+
* Level-number 88 declares a conditional data-name called STATE
41+
* which is associated with data-name USA-STATE.
42+
* STATE becomes TRUE when 'Virginia' is put into USA-STATE.
43+
* STATE is used in the parapgraph IS-STATE-VIRGINIA.
44+
*
3945
05 RESERVED PIC X(7).
4046
05 COMMENTS PIC X(50).
4147
*
@@ -136,9 +142,10 @@
136142
END-READ.
137143
*
138144
IS-STATE-VIRGINIA.
139-
IF USA-STATE = 'Virginia' THEN
140-
ADD 1 TO VIRGINIA-CLIENTS.
145+
IF STATE ADD 1 TO VIRGINIA-CLIENTS.
141146
END-IF.
147+
* When the current value of USA-STATE equals 'Virginia'
148+
* the conditional data-name STATE is TRUE.
142149
*
143150
WRITE-RECORD.
144151
MOVE ACCT-NO TO ACCT-NO-O.

0 commit comments

Comments
 (0)