Performance: tuning COBOL
| Profile first | |
| USAGE choices | |
| I/O patterns |
Profile first
Measure before tuning. Time the run, find the paragraph that dominates, and fix that one. Most COBOL bottlenecks are file I/O or a nested loop, not the arithmetic.
USAGE choices
Move hot counters and sums to USAGE COMP or COMP-4 (binary) so the CPU adds them directly instead of converting text. Keep money in COMP-3 for exact decimals, and leave DISPLAY for the outer layer where humans read it.
I/O patterns
Read files once, not once per lookup: load small reference tables into working storage, or sort both inputs by the same key and merge them in one pass. Let the SORT verb do the ordering instead of hand-written sorts, and keep WRITE buffers full by writing records in batches where the file allows it.
Next: Modern COBOL tour (2014+)
Article author: Arthur Isaev