COBOL Std 12 Common Defect Patterns Lessons from pgcobol

From Webhuis wiki
Jump to navigation Jump to search

12. Common Defect Patterns (Lessons from pgcobol)[edit]

The following defects were observed in the pgcobol reference project and are documented here as anti-patterns to avoid:

ID Severity Description and Prevention
D-01 High Generate loop commented out in main program — generation mode silently does nothing. Never leave PERFORM stubs commented out without removing the WHEN branch that invokes them.
D-02 Medium Seed prime (2) never inserted — first-run leaves DB in invalid state for the sieve. Document and test first-run initialisation as a separate mandatory step.
D-03 Medium Connection alias mismatch (primes vs primesdb) causes runtime SQL error. Enforce a single alias constant in WORKING-STORAGE referenced everywhere.
D-04 Medium Hard-coded credentials in WORKING-STORAGE. Use environment variables (see §10).
D-05 Medium COMMIT statement commented out after INSERT — relies on implicit auto-commit. Always include explicit COMMIT/ROLLBACK (see §6.4).
D-06 Low Two near-identical copybooks with different naming conventions (hyphens vs underscores). One copybook, one naming rule.
D-07 Low Report loop condition (session-method-eof = 9) never set on EOF; loop exits on error code 1 instead. Separate EOF (result=2) from error (result=1) per §7.1.


← Back to index