Skip to Content
0
Former Member
May 24, 2005 at 08:02 AM

Moving read only flatfile to folder.

17 Views

Hi all.

I have a problem i hope someone can help me with.

I am reading a flatfile from a server-library. After the file has been read and the information have been processed, it has to be moved to a backup folder. This is the code im using:

CONCATENATE p_dirnam '' file_list-name INTO l_fil1.
    CONCATENATE p_dirnam '' c_arkivdir
                               file_list-name INTO l_fil2.
    OPEN DATASET l_fil1 FOR INPUT IN TEXT MODE.
    IF sy-subrc = 0. "should always be OK
      OPEN DATASET l_fil2 FOR OUTPUT IN TEXT MODE.
      IF sy-subrc = 0.
        DO.
          READ DATASET l_fil1 INTO l_rec.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
          TRANSFER l_rec TO l_fil2.
        ENDDO.
        CLOSE DATASET l_fil2.
        CLOSE DATASET l_fil1.
* Slet input-fil
        DELETE DATASET l_fil1.

Now the problem is that the file is and has to be read only, and this apparently interferes with the copying. What can i do, is there another way of copying a flatfile i can use??

Regards

Liselotte