Editing
Naming and Coding Standards
(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!
== 5. Paragraph Naming Conventions == This project uses a '''prefix-number naming scheme''' derived from IBM COBOL shop practice: <span id="prefix-codes"></span> === 5.1 Prefix codes === {| !width="33%"| Prefix !width="33%"| Meaning !width="33%"| Example |- | <code>r</code> | Regular processing paragraph (business logic, I/O) | <code>r80-test-number</code> |- | <code>s</code> | System / infrastructure paragraph (DB connect, file open) | <code>s00-connect</code> |- | <code>e</code> | Error-handling paragraph | <code>e10-handle-db-error</code> |- | <code>x</code> | Exit / cleanup paragraph (always PERFORM last) | <code>x99-shutdown</code> |} <blockquote>'''Observation from existing source:''' The project uses <code>r</code> and <code>s</code> prefixes already. The <code>e</code> and <code>x</code> prefixes are introduced here as an extension. The <code>r99</code> convention for shutdown paragraphs is retained. </blockquote> <span id="numbering"></span> === 5.2 Numbering === * Two-digit sequence: <code>00</code>, <code>10</code>, <code>20</code> β¦ <code>90</code>, <code>99</code>. * Low numbers (00β29): initialisation / setup. * Mid numbers (30β79): main processing. * High numbers (80β89): sub-processing / helpers. * 90β98: cleanup and close. * 99: final exit / stop. * Leave gaps of 10 between paragraphs to allow insertion. <span id="name-format"></span> === 5.3 Name format === <pre><prefix><NN>-<short-hyphenated-description> Examples: r80-test-number r82-next-test-number r85-write-prime r89-get-next-divider r90-start-primes-report r99-close-primes s00-connect s01-cursor s02-fetch s99-disconnect</pre> <span id="rules"></span> === 5.4 Rules === * Paragraph names must be unique within the program. * A paragraph must do one thing. If it needs a comment explaining βalso does Xβ, split it. * Paragraphs called only from one place may be inlined (PERFORM vs inline code) β choose consistency over micro-optimisation. * Never use <code>GO TO</code> except for the structured <code>GO TO <paragraph></code> used as a skip (an accepted COBOL idiom). Do not use <code>ALTER</code>. ----- <span id="procedure-division-coding-rules"></span>
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