IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      PRACTIVE-B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.

01 NAGASA                        PIC 9(3).
01 I-DATA                        PIC X(100).
01 TUIKA-DATA                    PIC X(3) VALUE '...'.
01 IDX                           PIC 9(3).
01 END-FLAG                      PIC 9(1).
01 CHK-NAGASA                    PIC 9(3).

PROCEDURE DIVISION.
ACCEPT    NAGASA.
ACCEPT    I-DATA.
MOVE      1  TO IDX.
MOVE      0  TO END-FLAG.
COMPUTE CHK-NAGASA = NAGASA + 1.
PERFORM  
  UNTIL  IDX  >  NAGASA 
           OR
         END-FLAG = 1
  IF I-DATA(IDX:1) NOT = SPACE
  THEN
      CONTINUE
  ELSE
      DISPLAY I-DATA(1:IDX)
      MOVE  1  TO  END-FLAG
  END-IF
  COMPUTE  IDX = IDX + 1
END-PERFORM.

IF  IDX = 101
THEN
    DISPLAY I-DATA(1:NAGASA)
ELSE
    IF  END-FLAG NOT = 1
    THEN
        IF  I-DATA(CHK-NAGASA:1) = SPACE
        THEN
            DISPLAY I-DATA(1:NAGASA)
        ELSE
            DISPLAY I-DATA(1:NAGASA)TUIKA-DATA
    END-IF
END-IF.
STOP RUN.