Editing
COBOL Std 2 Source-Code Layout
(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!
== 2. Source-Code Layout == === 2.1 Column Format === All programs use fixed-format COBOL unless the project explicitly adopts free-format (<code>cobc -free</code>). In fixed format: {| class="wikitable" style="width:100%" ! Columns !! Area !! Rule |- | 1β6 || Sequence || Leave blank or use numeric sequence; never use for logic. |- | 7 || Indicator || Asterisk (<code>*</code>) = full-line comment. Hyphen (<code>-</code>) = continuation. Blank = code. |- | 8β11 || Area A || Division / section / paragraph headers; 01 and 77 level items; FD entries. |- | 12β72 || Area B || All other data definitions and procedural statements. |} === 2.2 Indentation === Indent subordinate levels by 4 spaces relative to their parent. Do not use tab characters. <syntaxhighlight lang="cobol"> 01 WS-CUSTOMER-RECORD. 05 WS-CUST-ID PIC X(6). 05 WS-CUST-NAME PIC X(40). 05 WS-CUST-BALANCE PIC S9(9)V99 COMP-3. </syntaxhighlight> Nested IF / EVALUATE constructs add 4 spaces per level: <syntaxhighlight lang="cobol"> EVALUATE TRUE WHEN dal-method-ok PERFORM R080-PROCESS-RECORD WHEN OTHER PERFORM E000-HANDLE-ERROR END-EVALUATE </syntaxhighlight> === 2.3 Line Length === Keep all code within columns 8β72 (Area A/B combined). Comments may use columns 8β72 as well. Do not rely on the reference area (73β80). === 2.4 Blank Lines and Section Separators === * One blank comment line before every paragraph header. * Three asterisk-border comment lines before every major section (see [[#3. Comment Standards|Β§3]]). * Use the compiler directive <code>/</code> (slash in column 7) to eject to a new listing page between major sections. ---- ---- ''[[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