4. Naming Conventions[edit]
4.1 General Rules[edit]
- Use hyphens (
-) as word separators — never underscores or camelCase.
- Maximum 30 characters for data names; 30 characters for paragraph names.
- COBOL reserved words in ALL CAPS; user-defined names in ALL CAPS (consistent with GnuCOBOL case-insensitivity).
- Names must reflect business purpose; avoid single-letter names and meaningless abbreviations.
- Approved abbreviations are listed in Appendix A.
4.2 Working-Storage and Linkage Prefixes[edit]
| Prefix |
Usage |
Example
|
WS- |
Working-Storage variables |
WS-CUSTOMER-ID
|
LS- |
Linkage-Section parameters |
LS-INPUT-RECORD
|
FS- |
File-Section records |
FS-CUSTOMER-FILE
|
SW- |
Switch / flag fields |
SW-END-OF-FILE
|
CTR- |
Counters |
CTR-RECORD-COUNT
|
ERR- |
Error-handling fields |
ERR-MESSAGE-TEXT
|
DB- |
SQL host variables |
DB-CUSTOMER-ROW
|
DAL- |
Data Access Layer interface |
DAL-METHOD-CODE
|
UI- |
User Interface / output fields |
UI-SCREEN-MESSAGE
|
DC- |
Data-conversion work fields |
DC-AMOUNT-WORK
|
4.3 Paragraph Naming — Numeric Prefix Scheme[edit]
Paragraphs use a four-digit numeric prefix to indicate their tier and purpose. The prefix creates an implicit call-hierarchy that is visible when reading source or a cross-reference listing.
| Range |
Section Purpose |
Example
|
| A000–A999 |
Main control / entry point |
A000-MAIN-CONTROL
|
| B000–B999 |
Initialisation routines |
B000-INITIALISE
|
| C000–C999 |
Main processing |
C100-PROCESS-RECORD
|
| D000–D999 |
Validation routines |
D000-VALIDATE-INPUT
|
| E000–E999 |
Error handling |
E000-HANDLE-ERROR
|
| R000–R999 |
Business logic routines |
R080-GET-NEXT-PRIME
|
| S000–S999 |
Database / system routines |
S000-DB-CONNECT
|
| Z000–Z999 |
Termination / cleanup |
Z000-PROGRAM-END
|
4.4 Copybook Naming[edit]
| Suffix |
Purpose |
Example
|
-REC |
Record layouts |
CUSTOMER-REC
|
-DAL |
Data Access Layer interface |
PRIMES-DAL
|
-UI |
User Interface layouts |
PRIMES-UI
|
-TAB |
SQL host-variable table layouts |
PRIMES-TAB
|
-ERR |
Error-code definitions |
SYSTEM-ERR
|
-SES |
Session / orchestration blocks |
PRIMES-SES
|
| name = Ambox{{subst:void|Don't change anything on this line. It will change itself when you save.}}
| subst = {{subst:substcheck}}
← Back to index