IDENTIFICATION DIVISION.
PROGRAM-ID. 168B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 K          PIC 9(03).
01 S          PIC X(100).
01 LEN        PIC 9(03).
*>
PROCEDURE DIVISION.
  ACCEPT K.
  ACCEPT S.
  UNSTRING S DELIMITED BY ' '
      INTO S COUNT LEN.
*>
  IF (LEN <= K)
    DISPLAY FUNCTION TRIM(S)
  ELSE
    DISPLAY S(1:K) '...'
  END-IF.
*>
  STOP RUN.
