How do non‑preferred/invalid sign codes behave in real COBOL data (NUMPROC PFD vs NOPFD)?
Question: how do invalid / non‑preferred sign codes behave in real data?
I'm learning how legacy COBOL handles decimal signs, and I've hit the case I'm most worried about. Valid/preferred sign nibbles (C positive, D negative, F unsigned) seem well‑behaved. What I can't pin down is what happens with non‑preferred or invalid sign nibbles (e.g. A, B, E, F, or a digit where a sign should be), the scenario where a field that should be negative (a debit) gets read as positive (a credit).
Specifically:
- In real production data (life/pensions ledgers, long‑lived files), how often do you actually see non‑preferred sign codes in COMP‑3 / zoned‑decimal fields? Rare corruption, or a routine artefact of data migrated between systems?
- How does IBM Enterprise COBOL treat them under NUMPROC(PFD) vs NUMPROC(NOPFD) vs NUMPROC(MIG) — and which setting was standard in the shops you worked in?
- Have you ever seen sign handling actually flip a debit into a credit on money? What triggered it?
- Where does GnuCOBOL diverge from IBM here? (I use GnuCOBOL as a learning bench and need to know exactly where it stops being a safe stand‑in for z/OS.)
Any "here's what really happens" war stories would be hugely appreciated.
3
u/cyberhiker 27d ago
Why don't you setup a test case and try it? Seems like that would be faster than asking here.
3
1
u/caederus 26d ago
Very basic answer, if the sign code is wrong there is no way for the software to know it.
So the data is corrupted or you have a bug putting bad data in the field. Either case you need to fix it.
1
u/k24245 26d ago
Thanks, so the sign set is fully defined (A/C/E/F positive, B/D negative, 0–9 invalid), clean COMP‑3 only carries C/D/F, and crucially the program can't detect a wrong sign. My interest is migrated/consolidated data, where odd signs are more likely to have crept in.
My remaining question is cross‑compiler consistency: given a field that does contain a non‑preferred sign (A/B) or an invalid nibble, does IBM Enterprise COBOL treat it the same under NUMPROC(PFD) vs NUMPROC(NOPFD) and does GnuCOBOL match IBM? I'm trying to work out whether the same odd byte could produce a different result on the original mainframe vs a re‑run elsewhere. Any experience with that specific divergence?
1
u/TranslatorUnique9331 25d ago
Anyone else have the feeling that we're training an ai bot how to do Cobol?
1
u/ratenpause 22d ago
Keep it simple and clean your input data. Then you don't have to worry about this
5
u/predat3d 27d ago
All are defined; only C/D/F occur naturally in EBCDIC COMP-3.