Skip to main content

[Migrated content. Thread originally posted on 02 August 2011]

I am trying to copy a file from one location to another. While on my system this works fine it has an issue on another system. I am using the following:


       01  file-status             pic xx comp-x.
       01  redefines file-status.
           03  fs-byte-1 pic x comp-x.
           03  fs-byte-2 pic x comp-x.
       01  byte-1          pic 9(03).
       01  byte-2          pic 9(03).

           call "CBL_COPY_FILE" using SOURCE-FILE
                                      ARCHIVE-FILE
                                RETURNING file-STATUS.

           IF file-STATUS NOT = ZERO
               move fs-byte-1 to byte-1
               move fs-byte-2 to byte-2.

When I display the values of byte-1/byte-2 I get the following: 037/057

The 057 is the decimal number for 9 and the error code 037 is “File access denied”. What I am trying to figure out is A) is it the source file or the archive file that access is denied or is it B) a windows rights issue.

I have given full rights to “everyone” and I still get the message.

This is using Net Express 4.0 in a windows environment.

[Migrated content. Thread originally posted on 02 August 2011]

I am trying to copy a file from one location to another. While on my system this works fine it has an issue on another system. I am using the following:


       01  file-status             pic xx comp-x.
       01  redefines file-status.
           03  fs-byte-1 pic x comp-x.
           03  fs-byte-2 pic x comp-x.
       01  byte-1          pic 9(03).
       01  byte-2          pic 9(03).

           call "CBL_COPY_FILE" using SOURCE-FILE
                                      ARCHIVE-FILE
                                RETURNING file-STATUS.

           IF file-STATUS NOT = ZERO
               move fs-byte-1 to byte-1
               move fs-byte-2 to byte-2.

When I display the values of byte-1/byte-2 I get the following: 037/057

The 057 is the decimal number for 9 and the error code 037 is “File access denied”. What I am trying to figure out is A) is it the source file or the archive file that access is denied or is it B) a windows rights issue.

I have given full rights to “everyone” and I still get the message.

This is using Net Express 4.0 in a windows environment.
You should try executing the same copy command from a command prompt outside of your application and see if it works. This will tell you if it is a permissions issue or not.

If it is not a permissions issue then it may be that the target file already exists and is open in another process?

Is the source file being created in the program that is trying to do the copy and is it closed before the copy is attempted?