REPORT ZBOX NO STANDARD PAGE HEADING.
PERFORM BOX USING 1 2 'TITLE1'.
PERFORM BOX USING 5 4 'TITLE2'.
PERFORM BOX USING 11 7 'TITLE3'.
PERFORM BOX USING 20 7 'TITLE4'.
*---------------------------------------------------------------------*
* FORM BOX                                                            *
* Draw a box with title                                               *
*    YPOS:   y coordinate of the upper left corner                    *
*    HEIGHT: height of the box                                        *
*    TEXT:   the title of te box                                      *
*---------------------------------------------------------------------*
FORM BOX USING VALUE(YPOS) HEIGHT TEXT.
*
  DATA: WIDTH TYPE I VALUE 84,
        R TYPE I, K TYPE I.
* Bottom horizontal line
  R = HEIGHT + YPOS.
  SKIP TO LINE R.
  DO WIDTH TIMES.
    WRITE '-' NO-GAP.
  ENDDO.
* Top horizontal line with text
  K = STRLEN( TEXT ).
  R = WIDTH - 2 - K.
  SKIP TO LINE YPOS.
  WRITE:  '--'.
  WRITE AT 3(K) TEXT NO-GAP.
  DO R TIMES.
    WRITE:  '-' NO-GAP.
  ENDDO.
* Vertical lines
  DO HEIGHT TIMES.
    SKIP TO LINE YPOS.
    WRITE: '|'. POSITION WIDTH. WRITE: '|'.
    YPOS = YPOS + 1.
  ENDDO.
ENDFORM.