Thread: COBOL

COMP vs COMP-3 vs DISPLAY - still lost

Started by Jordan • user4 replies278 viewsLast activity 2 weeks ago
Post #1
0 votes
Jordan
Reputation
12
Posts: 32
Joined: May 2, 2026, 11:10 AM
Posted: Jul 27, 2026, 10:30 AM

Everyone at work throws around COMP and COMP-3. I know DISPLAY is the default but I do not know when to pick which.

Also why does DISPLAY of a COMP field look like garbage?

Post #2
0 votes
Marty
Reputation
412
Posts: 58
Joined: Aug 12, 2024, 9:14 AM
Posted: Jul 27, 2026, 12:30 PM

DISPLAY = stored as characters (readable, slower for math).
COMP / BINARY = binary integer, fast for whole numbers.
COMP-3 = packed decimal, common for money with decimals (V99).

DISPLAY of COMP looks weird because you are printing raw binary. MOVE it to a PIC 9 or edited field first, then DISPLAY that.

Post #3
1 votes
Rick
Reputation
302
Posts: 22
Joined: Jun 14, 2024, 9:41 AM
Posted: Jul 27, 2026, 4:30 PM

Shop default here: counters COMP, amounts COMP-3, anything going to a report gets moved to an edited PIC like ZZZ9.99.

Post #4
0 votes
Jordan
Reputation
12
Posts: 32
Joined: May 2, 2026, 11:10 AM
Posted: Jul 28, 2026, 1:30 PM

Moved COMP to PIC ZZ9 before DISPLAY. Numbers finally make sense. Thanks.

You must be signed in to reply to this thread