Packed-Decimal COBOL: Exact Money Math Without Floating-Point Drift
Use COBOL USAGE COMP-3 to store currency as packed decimal and avoid binary floating-point rounding in ledgers and interest calculations.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Use COBOL USAGE COMP-3 to store currency as packed decimal and avoid binary floating-point rounding in ledgers and interest calculations.
Parse and generate JSON directly in Enterprise COBOL batch programs using intrinsic functions, with syntax cautions and verification steps.
An architecture note on using COBOL SORT with INPUT/OUTPUT procedures to validate, filter, and aggregate a large sequential file under memory constraints, covering design boundaries, operational checks, failure modes, and when to change the approach.
Learn how COBOL’s REDEFINES clause lets you map multiple logical views onto the same storage space, cutting redundant code and I/O when parsing fixed‑width files. Dive into a concrete example, trade‑offs, and a quick sanity‑check checklist.
Learn how the COBOL REDEFINES clause overlays multiple data layouts on one memory block to handle mixed-format records efficiently, with a worked example and risk checklist.
When packed‑decimal values in COBOL produce garbled numbers, sign errors, or silent overflows, a systematic diagnostic approach can pinpoint the root cause. Follow this concise checklist to identify, verify, and correct COMP‑3 issues.
Use COBOL intrinsic functions to convert YYYYMMDD dates to integer day counts and back, avoiding manual date math in batch programs.
Replace fragile hand‑rolled date math in COBOL with the DATE-OF-INTEGER intrinsic. Learn how to convert packed‑decimal dates, handle leap years, and avoid runtime errors with a practical example and clear trade‑offs.
Learn how to implement FILE-STATUS checking in COBOL to prevent runtime crashes and handle End-of-File (EOF) and missing file errors gracefully.