◄ TOOLS COBOL NUMBER FORMATTER HOME ►

⚙ COBOL NUMBER FORMATTER

Enter a number. Choose a PICTURE clause. See it formatted. Learn how COBOL edits numbers.

📝 INPUT

📊 FORMATTED OUTPUT

$12,345.67
PIC $$,$$9.99 — Dollar sign + commas
Input: 12345.67

🔧 COBOL Code Snippet

01 WS-FORMATTED-OUT PIC $$,$$9.99. MOVE WS-AMOUNT TO WS-FORMATTED-OUT. DISPLAY "Invoice total: " WS-FORMATTED-OUT.

📖 Explanation

PIC 9(4).99 stores a number with 4 integer digits, an explicit decimal point, and 2 fraction digits. The decimal point is a real character in the output — not implied like V. Use this when you want the decimal point visible in reports or displays.

📋 Quick Reference: Common PICTURE Formats

PICTUREMeaning12345.67 →
9(4)V99Implied decimal, 4 int + 2 frac1234567
9(4).99Explicit decimal point12345.67
Z(4)9.99Zero suppression (blanks)12345.67
$$,$$9.99Dollar + comma$12,345.67
-9(4).99Sign handling-12345.67
*(4).99Asterisk check protection*12345.67
9(4).99CRCR for credit balances12345.67CR
Click any row above to load that PICTURE clause. Numbers displayed assume positive value; negative values show CR or minus sign where applicable.

🐸 Froggy's Rule

"Always ROUNDED for financial calcs. ALWAYS. And if you use EDIT patterns on a signed field, remember: the sign goes before the dollar sign in the PICTURE, not after. -$$$,$$9.99, not $$-$,$$9.99. I see this mistake every year from new hires."