Reasons for allocation errors when copying files

If another job allocates a member with too strong a lock state, the copy operation might end with an error message. This is also true if the library containing the file is renamed during the copy operation.

When a copy command runs, the to-file might be locked (similar to an *EXCL lock with no time-out) so that no access is possible. Any attempt to use a function that must touch the to-file locks up the workstation until the copy command completes. For instance, you should not use the following functions on a to-file that you are copying:

   WRKACTJOB
      Option 11 (Work with Locks)
      Option 5  (Work with Job Member Locks)
      Option 8  (Work with Object Locks)
   DSPDBR
   DSPFD
   DSPFFD
   WRKJOB
      Option 12 (Work with Locks, if active)
      Option  5 (Work with Job Member Locks)
      F10 (Display Open Files, if active)
   WRKLIB
      The library containing the to-file
   DSPLIB
      The library containing the to-file
   WRKOBJLCK
   WRKRCDLCK

If you want to display any information about a to-file, you must anticipate the requirement and force the copy command to use block record-at-a-time operations by specifying ERRLVL(1).

If you anticipate that problems might arise because of this, you can preallocate the files and members using the Allocate Object (ALCOBJ) command.

Related information
Control language (CL)