File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
COBOL Programming Course #1 - Getting Started Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 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 .
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.
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.
Original file line number Diff line number Diff line change 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 *
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.
You can’t perform that action at this time.
0 commit comments