COBOL Manual for TNS and TNS/R Programs
Procedure Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
8-11
Paragraphs
Paragraphs
A paragraph groups related sentences and statements together and identifies them by
one name. Using the name, GO TO, PERFORM, SORT and MERGE statements can
transfer control to the paragraph.
paragraph-name
is either a COBOL word consisting of up to 30 alphanumeric characters or an
integer of up to 30 digits.
sentence
is described in Sentences. A sentence ends with a period; therefore, a paragraph
ends with the period at the end of its last sentence.
Example 8-6. Paragraph With One Sentence
CHK-REPORT-YY.
IF CURRENT-YY IS LESS THAN 0
OR GREATER THAN 99
DISPLAY "REPORT YEAR IS NOT BETWEEN 00 AND 99, "
"REENTER YEAR"
ACCEPT CURRENT-YY
GO TO CHK-REPORT-YY.
Example 8-7. Paragraph With Several Sentences
CONVERT-REPORT-DATE-TO-SERIAL-DAY.
MOVE CURRENT-YY TO REPORT-SERIAL-YEAR.
MOVE 0 TO DIVIDE-RESULT
LEAP-YEAR.
DIVIDE REPORT-SERIAL-YEAR BY 4
GIVING DIVIDE-RESULT
REMAINDER LEAP-YEAR.
IF LEAP-YEAR EQUAL TO 0
MOVE 1 TO LEAP-YEAR
ELSE
MOVE 0 TO LEAP-YEAR.
ADD CURRENT-DD
DAYS-TO-DATE(CURRENT-MM)
GIVING REPORT-SERIAL-DAYS.
IF REPORT-SERIAL-DAYS IS GREATER THAN 59
ADD LEAP-YEAR TO REPORT-SERIAL-DAYS.
paragraph-name
.
sentence
VST115.vsd