Fix arithmetic and control flow bugs in batch programs#32
Open
DukeDeSouth wants to merge 1 commit into
Open
Conversation
CBACT04C: add ROUNDED to interest COMPUTE to prevent truncation
CBTRN02C: fix sign error in credit limit check (debit is already negative),
add proper error handling on account REWRITE failure,
fix wrong file status variable in DALYREJS close
CBTRN03C: replace NEXT SENTENCE with structured IF to prevent
premature loop exit, remove stale ADD at EOF
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Can confirm the CBTRN03C double-counting. Ran a minimal test on z/OS V2.4 with IBM Enterprise COBOL V6.4:
Report output: Detail line shows $5.00, but both totals show $10.00. The EOF ELSE branch at lines 200-201 adds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi there,
Was reading through the batch programs and noticed a few issues that could cause incorrect results in production:
CBACT04C (Interest Calculator):
COMPUTE WS-MONTHLY-INTwas missingROUNDED, causing interest to be systematically truncated rather than rounded. For a rate of 21.50% on a $10,000 balance, this means $179.16 instead of $179.17 — adds up across accounts.CBTRN02C (Transaction Posting):
CREDIT - DEBIT, butACCT-CURR-CYC-DEBITalready stores negative values (payments are added viaADD negative-amount). So3000 - (-2000)= 5000 instead of 1000. This causes valid transactions to be rejected as overlimit after the customer makes payments.REWRITEfailure on account file was silently ignored — transaction gets written but balance never updates.9300-DALYREJS-CLOSEwas displayingXREFFILE-STATUSinstead ofDALYREJS-STATUS(copy-paste).CBTRN03C (Transaction Report):
NEXT SENTENCEinside an inlinePERFORM...END-PERFORMtransfers control past theEND-PERFORM.period, effectively breaking out of the loop on the first out-of-range transaction. Replaced with a nestedIFfor proper date filtering.TRAN-AMTto totals (last record counted twice).All changes are minimal and isolated — no new fields, no copybook changes, no interface changes.
Cheers
Made with Cursor