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