Editing
COBOL Std 4 Naming Conventions
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 4. Naming Conventions == === 4.1 General Rules === * Use hyphens (<code>-</code>) 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 β Approved Abbreviations|Appendix A]]. === 4.2 Working-Storage and Linkage Prefixes === {| class="wikitable" style="width:100%" ! Prefix !! Usage !! Example |- | <code>WS-</code> || Working-Storage variables || <code>WS-CUSTOMER-ID</code> |- | <code>LS-</code> || Linkage-Section parameters || <code>LS-INPUT-RECORD</code> |- | <code>FS-</code> || File-Section records || <code>FS-CUSTOMER-FILE</code> |- | <code>SW-</code> || Switch / flag fields || <code>SW-END-OF-FILE</code> |- | <code>CTR-</code> || Counters || <code>CTR-RECORD-COUNT</code> |- | <code>ERR-</code> || Error-handling fields || <code>ERR-MESSAGE-TEXT</code> |- | <code>DB-</code> || SQL host variables || <code>DB-CUSTOMER-ROW</code> |- | <code>DAL-</code> || Data Access Layer interface || <code>DAL-METHOD-CODE</code> |- | <code>UI-</code> || User Interface / output fields || <code>UI-SCREEN-MESSAGE</code> |- | <code>DC-</code> || Data-conversion work fields || <code>DC-AMOUNT-WORK</code> |} === 4.3 Paragraph Naming β Numeric Prefix Scheme === 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. {| class="wikitable" style="width:100%" ! Range !! Section Purpose !! Example |- | A000βA999 || Main control / entry point || <code>A000-MAIN-CONTROL</code> |- | B000βB999 || Initialisation routines || <code>B000-INITIALISE</code> |- | C000βC999 || Main processing || <code>C100-PROCESS-RECORD</code> |- | D000βD999 || Validation routines || <code>D000-VALIDATE-INPUT</code> |- | E000βE999 || Error handling || <code>E000-HANDLE-ERROR</code> |- | R000βR999 || Business logic routines || <code>R080-GET-NEXT-PRIME</code> |- | S000βS999 || Database / system routines || <code>S000-DB-CONNECT</code> |- | Z000βZ999 || Termination / cleanup || <code>Z000-PROGRAM-END</code> |} === 4.4 Copybook Naming === {| class="wikitable" style="width:100%" ! Suffix !! Purpose !! Example |- | <code>-REC</code> || Record layouts || <code>CUSTOMER-REC</code> |- | <code>-DAL</code> || Data Access Layer interface || <code>PRIMES-DAL</code> |- | <code>-UI</code> || User Interface layouts || <code>PRIMES-UI</code> |- | <code>-TAB</code> || SQL host-variable table layouts || <code>PRIMES-TAB</code> |- | <code>-ERR</code> || Error-code definitions || <code>SYSTEM-ERR</code> |- | <code>-SES</code> || Session / orchestration blocks || <code>PRIMES-SES</code> |} {{Ambox | type = notice | text = '''File naming''' β copybook file names must use hyphens, not underscores. The pgcobol project contains both <code>primes-table.cpy</code> and <code>primes_table.cpy</code>; this ambiguity is a known defect and must not be replicated. }} ---- ---- ''[[Cobol programming standards|β Back to index]]''
Summary:
Please note that all contributions to Webhuis wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see
Project:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Voorpagina
Cobol and PostgreSQL
PostgreSQL
CFEngine
Proxmox
Webhuis Kennisbank
Basale infra
Webhuis bouwstenen
Webhuis configuratie
Webhuis Infra
Webhuis Support
Webhuis Raspberry
Opzet Applicaties
Business Applicaties
Community portal
Current events
Recent changes
Random page
Help
sitesupport
Tools
What links here
Related changes
Special pages
Page information