I've seen the following paragraph naming structure lots of times:
nnnn-PARAGRAPH-NAME.
Where nnnn
stands for a 4 digit number.
Here is a complete example:
0000-MAINLINE.
PERFORM 1000-INITIALIZE-THE-PROGRAM.
PERFORM 2000-PROCESS-1-BILLING-RECORD
UNTIL 88-100-ALL-RECORDS-PROCESSED.
PERFORM 3000-TERMINATE-THE-PROGRAM.
GOBACK.
1000-INITIALIZE-THE-PROGRAM.
PERFORM 1100-VALIDATE-CONTROL-CARD.
PERFORM 1200-OPEN-THE-FILES.
PERFORM 8000-GET-NEXT-BILLING-RECORD.
1100-VALIDATE-CONTROL-CARD.
PERFORM 1110-READ-CONTROL-CARD.
PERFORM 1120-EDIT-CONTROL-CARD.
1110-READ-CONTROL-CARD.
PERFORM 9000-ABEND-THE-PROGRAM. *> IF A READ ERROR OCCURRED
1120-EDIT-CONTROL-CARD.
PERFORM 9000-ABEND-THE-PROGRAM *> IF AN EDIT ERROR OCCURRED
1200-OPEN-THE-FILES.
PERFORM 9000-ABEND-THE-PROGRAM *> IF AN OPEN ERROR OCCURRED
2000-PROCESS-1-BILLING-RECORD.
PERFORM 2100-CALCULATE-BILLABLE-AMT.
PERFORM 2200-PRINT-BILLING-REPORT.
PERFORM 8000-GET-NEXT-BILLING-RECORD.
2200-PRINT-BILLING-REPORT.
PERFORM 2210-PRINT-REPORT-HEADER. *> WHEN IT'S NEEDED
3000-TERMINATE-THE-PROGRAM.
PERFORM 3100-CLOSE-THE-FILES.
PERFORM 3200-DISPLAY-FINAL-MESSAGES.
8000-GET-NEXT-BILLING-RECORD.
PERFORM 9000-ABEND-THE-PROGRAM. *> IF A READ ERROR OCCURRED
9000-ABEND-THE-PROGRAM.
Therefore, my questions are the following:
The numbers tell you the program structure. In this program:
So the program call structure is
0000-
+---------------------------+------------------------------+
1000- 2000- 3000-
+--------+------+ +------+------+ +-------+-------+
1100- 1200- 2100- 2200- 3100- 3200-
etc...
Once you get used to the numbering system it makes understanding program so much easier. Different sites do it differently, some may use letters as well/instead of numbers e.g.
Perform A000-Initialise
Perform B000-Main
Perform C000-Finalise
A000-Initialise.
Perform A100-...
etc
At any one site, they will use the same numbering standard across all (or most programs).
Sites might reserve the first number/letter for specific purposes. This is more common if using A000-, B000- format. You might use R... for file reads W... for file writes S... for SQL calls etc.
The numbering system makes life easier for the experienced programmer. Having worked in other languages, it should be used other procedural languages other than Cobol.