IDENTIFICATION DIVISION.
PROGRAM-ID. FIZZBUZZ.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 I PIC 9(3).
01 HENSHU-IKI PIC X(4).
01 HENSHU-NUM REDEFINES HENSHU-IKI PIC X(4).
01 DUMMY-IKI PIC X(1).
PROCEDURE DIVISION.
PERFORM VARYING I FROM 1 BY 1 UNTIL I > 100
EVALUATE TRUE
WHEN FUNCTION MOD(I 3) = 0 AND FUNCTION MOD(I 5) = 0
DISPLAY "FIZZBUZZ"
WHEN FUNCTION MOD(I 3) = 0
DISPLAY "FIZZ"
WHEN FUNCTION MOD(I 5) = 0
DISPLAY "BUZZ"
WHEN OTHER
MOVE SPACES TO HENSHU-IKI
MOVE I TO HENSHU-NUM
UNSTRING
HENSHU-IKI DELIMITED BY ALL SPACE
INTO DUMMY-IKI HENSHU-IKI
END-UNSTRING
DISPLAY FUNCTION TRIM(HENSHU-IKI)
END-EVALUATE
END-PERFORM.
STOP RUN.