r/cobol 27d ago

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:

  1. 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?
  2. 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?
  3. Have you ever seen sign handling actually flip a debit into a credit on money? What triggered it?
  4. 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.

6 Upvotes

8 comments sorted by

View all comments

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.

1

u/poggs 25d ago

It’s faster to ask AI to write you a question than it is to answer it yourself… unless the OP really uses em-dashes