>>SOURCE FORMAT IS FREE *> cobol-edited-pictures-money.cob — the same five amounts through *> eight edited PICTURE strings *> Dialect: GnuCOBOL 3.x, free format *> Status : desk-checked against the GnuCOBOL 3.2 Programmer's Guide; *> compiled and run with GnuCOBOL 3.2 on 2026-10-29 *> Inputs : none (five test amounts are VALUE clauses) *> Outputs: DISPLAY lines on the console, one per edited item per amount *> Build : cobc -x cobol-edited-pictures-money.cob *> Run : ./cobol-edited-pictures-money *> (Windows: cobol-edited-pictures-money.exe) IDENTIFICATION DIVISION. PROGRAM-ID. EDITED-MONEY. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. *> The sending field is signed with two decimals. Every edited item *> below receives the same value and shows it differently. 01 Test-Values. 05 FILLER PIC S9(7)V99 VALUE 1234567.89. 05 FILLER PIC S9(7)V99 VALUE 42.50. 05 FILLER PIC S9(7)V99 VALUE 0. 05 FILLER PIC S9(7)V99 VALUE -1234.56. 05 FILLER PIC S9(7)V99 VALUE -0.05. 01 Test-Table REDEFINES Test-Values. 05 Test-Amount OCCURS 5 TIMES PIC S9(7)V99. 77 Amount PIC S9(7)V99. 77 Show-Raw PIC -9(7).99. *> Zero suppression and a thousands separator: 9 characters. 77 Ed-Z PIC ZZ,ZZ9.99. *> Floating currency sign: 9 characters, four integer digits at most. 77 Ed-Dollar PIC $$,$$9.99. *> Floating minus sign: 12 characters, six integer digits at most. 77 Ed-Minus PIC -,---,--9.99. *> Trailing minus and trailing CR: the sign sits after the digits. 77 Ed-Trail-Minus PIC 9(6).99-. 77 Ed-CR PIC 9(6).99CR. *> Check protection: leading zeros become asterisks. 77 Ed-Star PIC **,**9.99. *> Simple insertion of blanks and slashes; no sign, no decimals. 77 Ed-Phone PIC 9(3)B9(3)B9(4). 77 Ed-Date PIC 9(4)/9(2)/9(2). 77 Back-To-Number PIC S9(7)V99. 77 I PIC 9. PROCEDURE DIVISION. Main-Paragraph. PERFORM VARYING I FROM 1 BY 1 UNTIL I > 5 MOVE Test-Amount(I) TO Amount MOVE Amount TO Show-Raw DISPLAY "Amount " Show-Raw MOVE Amount TO Ed-Z MOVE Amount TO Ed-Dollar MOVE Amount TO Ed-Minus MOVE Amount TO Ed-Trail-Minus MOVE Amount TO Ed-CR MOVE Amount TO Ed-Star MOVE Amount TO Ed-Phone MOVE Amount TO Ed-Date DISPLAY " ZZ,ZZ9.99 [" Ed-Z "]" DISPLAY " $$,$$9.99 [" Ed-Dollar "]" DISPLAY " -,---,--9.99 [" Ed-Minus "]" DISPLAY " 9(6).99- [" Ed-Trail-Minus "]" DISPLAY " 9(6).99CR [" Ed-CR "]" DISPLAY " **,**9.99 [" Ed-Star "]" DISPLAY " 9(3)B9(3)B9(4) [" Ed-Phone "]" DISPLAY " 9(4)/9(2)/9(2) [" Ed-Date "]" END-PERFORM *> Going the other way: text to number with NUMVAL, then edited again. COMPUTE Back-To-Number = FUNCTION NUMVAL(" -1234.56 ") MOVE Back-To-Number TO Ed-Trail-Minus DISPLAY "NUMVAL round trip [" Ed-Trail-Minus "]" STOP RUN.