Skip to end of metadata
Go to start of metadata

This program doesn't do what it announces

DATA fname(60) VALUE 'myfile'.
DATA: text1(12) VALUE 'abcdefghijkl',
      text2(5),
      leng TYPE i.

OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
TRANSFER text1 TO fname.
CLOSE DATASET fname.


OPEN DATASET fname FOR INPUT IN BINARY MODE.
DO.
  READ DATASET fname INTO text2 LENGTH leng.
  WRITE: / sy-subrc, text2, leng.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
ENDDO.
CLOSE DATASET fname.
DATA fname(60) VALUE 'myfile'.
DATA: text1(4) VALUE '1234 ',
      text2(8) VALUE '12345678',
      text3(2),
      leng TYPE i.

OPEN DATASET fname FOR OUTPUT IN TEXT MODE.
TRANSFER: text1 TO fname,
          text2 TO fname.
CLOSE DATASET fname.

OPEN DATASET fname FOR INPUT IN TEXT MODE.
DO 2 TIMES.
  READ DATASET fname INTO text3 LENGTH leng.
  WRITE: / text3, leng.
ENDDO.
CLOSE DATASET fname.