Repository navigation
det: TRUNC(OPT) as IBM defines it -- STD for conforming binary values, a named stop past the PICTURE (Part of #4706) - #4746
Merged
Merged
Conversation
…, a named stop past the PICTURE (Part of #4706) IBM (Enterprise COBOL 6.x Programming Guide, "TRUNC"): under TRUNC(OPT) "the compiler assumes that data conforms to PICTURE specifications in USAGE BINARY receiving fields in MOVE statements and arithmetic expressions", truncating either to the PICTURE or to the halfword / fullword / doubleword; for data that does not conform "unpredictable results could occur". Conforming, OPT's results are STD's. - det runtime: Codec.truncOpt / Cobol.swapTruncOpt. Computes as TRUNC(STD) and stops by name ("TRUNC(OPT): value exceeds PICTURE; IBM result unpredictable") before a value past a COMP / COMP-4 / BINARY receiver's PICTURE is stored (MOVE, arithmetic store, the binary scratch of typed items, a non-digit zoned MOVE). COMP-5, ON SIZE ERROR (nothing stored) and Db2 host-variable assignment by byte width do not stop. - generator: program.trunc_mode (STD / BIN / OPT through the one resolver); an OPT entry adds Cobol.swapTruncOpt(true) and restores it; a typed binary item's MOVE goes through the runtime's store under OPT. STD / BIN ports are unchanged. - oracle: TRUNC(OPT) compiles -fbinary-truncate (STD). A port without the stop (model, generated) is proven as STD: a declared difference of kind "option" in its evidence record (equivalence_common.option_differences -> report -> evidence.record_proof). - estate options: CBSA's TRUNC(OPT) PARM is honoured (no applied_value, no deviation). - docs: register C1 / C5 / C4, and the #4706 compile-option table's TRUNC rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
Contributor
… PARM (Part of #4706) Both model ports prove as before (INQACC 14 scenarios, UPDACC 10). INQACC has no TRUNC card, so its model port -- no stop on a value past a binary PICTURE -- is proven as TRUNC(STD): a declared difference of kind "option" in its record. UPDACC's own TRUNC(STD) card leaves none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
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.
Part of #4706 -- the TRUNC(OPT) row (follow-up to #4704 / #4719, which proved CBSA's OPT programs under TRUNC(STD) as a declared deviation).
IBM (Enterprise COBOL for z/OS 6.x Programming Guide, "TRUNC"): under TRUNC(OPT) "the compiler assumes that data conforms to PICTURE specifications in USAGE BINARY receiving fields in MOVE statements and arithmetic expressions", truncating "either ... to the number of digits in the PICTURE clause, or to the size of the binary field in storage (halfword, fullword, or doubleword)"; for non-conforming data "unpredictable results could occur ... dependent on the particular code sequence generated". Conforming, OPT = STD.
Model
Codec.truncOpt,Cobol.swapTruncOpt): compute as STD; stop by name --TRUNC(OPT): value exceeds PICTURE; IBM result unpredictable (<v> into a <n>-digit binary item) is not modelled-- before a value past a COMP / COMP-4 / BINARY receiver's PICTURE is stored (MOVE, arithmetic store, typed-item scratch, non-digit zoned MOVE). COMP-5, ON SIZE ERROR (nothing stored) and Db2 host-variable assignment by byte width do not stop.program.trunc_mode(STD/BIN/OPT via the one resolver); OPT entries addCobol.swapTruncOpt(true)and restore it; typed binary MOVEs go through the runtime store under OPT. STD/BIN ports' text unchanged.-fbinary-truncate. A scenario reaching a non-conforming value stops on the port side, so the Java run fails with the named message (asHfp.divideNested/ NUMVAL refusals) -- never judged, never a silent pass.optionin its evidence record (equivalence_common.option_differences-> report.json ->evidence.record_proof).applied_value,deviations()empty).Proofs
det_port.py checkvs origin/main: every port's runtime copy changes (Cobol/Codec, inert unless OPT); service text changes only for cbsa-custctrl / delacc / inqacc (the OPT swap).proof_sweep.py --det-onlyover all 9 cbsa-* (Db2 local): 9/9 proven, same scenarios/coverage; no scenario hits the TRUNC(OPT) stop. Non-Db2 ports: CI det-sweep.tests/cobol_mainframe/test_trunc_opt.py(19, incl. Docker e2e: conforming program under OPT == cobc STD output; 5 non-conforming shapes stop by name, bytes and typed).pr_gates --fast5/5,--ratchets7/7.Noted, not changed: in typed mode under STD the lifted-binary MOVE paths (
bin_valueliteral wrap, same-size BIN->BIN copy) do not truncate to the PICTURE -- a latent STD issue for a follow-up.🤖 Generated with Claude Code
https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D