COBOL: How to Write Clean Programs

Writing clean logic avoids many issues in the production. When the code is legible the support team does take less time for any production issues. Below listed ideas useful to make your programs clean and operational.

10 Ideas to Write Clean COBOL Programs.

  1. Always remove extra variables declared in working storage section
  2. Use different paras for different business logic . Do not put all your business logic in one para.
  3. Reduce usage of GO To statements
  4. Use wherever required 88 level condition statements
  5. Always write comments for each para what it does. In terms of business words.
  6. Use PERFORM statements always. Must use “Exit” statement at the end of each para.
  7. Use ‘OPEN’ statement for all the files at one place. And CLOSE all the files at one place.
  8. Check IF conditions properly. If lengthy IF conditions are there (more than 3), then go for EVALUATE
  9. Use ‘SEARCH ALL’ only. if your array is having more than 50 records. Else use ‘SEARCH’
  10. Check empty lines between the COBOL code. Maintain only ‘one’ empty line.


COBOL Search | PERFORM Statements

Latest posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.