Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Locking an IFS object

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • dscorca5
    replied
    Be careful with CHKOUT, if you check out an IFS file you cannot use that object if you try to use it in a secondary called program. The best solution I've come up with is to move the IFS file (using the MOV command) to an "In process" folder.
    Last edited by dscorca5; 08-22-2019, 06:54 PM.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Locking an IFS object

    Instead of using QCMDEXC, have you tried using the QCAPCMD API? We've had good luck using this with its standard API error code parameter, which can return exception messages to your RPG program if the command fails. It is about as close as you can get to a MONMSG in RPG. This won't help you allocate the file, but it will let you retry the command if you determine it failed due a lock problem. Just make sure you limit the number of automatic retries allowed.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Locking an IFS object

    I have a little background job which every minute or so uses the opendir & readdir functions to process the streamfiles within an IFS directory. Each file read is simply copied using CPYFRMIMPF to move the contents into a physical file. Every now and then the CPYFRMIMPF fails as it is unable to lock the object. Is there a command/function I can use similar to ALCOBJ which will allow me to lock the file before copying and if I can't lock the file, Iter in a loop until I can. I had tried using the %ERROR %BIF on the Call to QCMDEXC CMD('CPYFRMIMPF etc') to detect a failure, but this doesn't seem to work in this scenario Any help would be appreciated

    Leave a comment:


  • g11021
    replied
    Locking an IFS object

    Check out the CHKOUT/CHKIN commands. The are similar to ALCOBJ/DLCOBJ but cannot allocate exclusive and the lock is not released when the job ends. Jørn

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Locking an IFS object

    Fair enough, thanks for being honest

    Leave a comment:


  • David Abramowitz
    replied
    Locking an IFS object

    CHGDOCD allows you to set the authority of any object in QDLS on the fly. I've never used it outside of QDLS, and cannot comment on the effectiveness. Dave

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Locking an IFS object

    I've just had a look at the CHGDOCD option (thought it would be the quickest and easiest to implement but can't see how this would allow you to lock a file. It looks as if this can only be used with Documents and folders, not objects accessed in the IFS using WRKLNK

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Locking an IFS object

    Thanks guys, The files are just plain text files. If they are being locked, it will just be via the FTP process that places them on the 400 in the first place. They're not accessed after that other than by the background job.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Locking an IFS object

    What kind of PC files are you processing in the folder? What extension (.TXT, .CSV, .XLS, etc)? I've played around the the 'open' API and mode O_SHARE_NONE before. It doesn't seem to work for some file types though such as MS Word DOCs, which seem to lock the hidden file it creates when you open the document, and not the document itself. Chris
    Code

    Leave a comment:


  • David Abramowitz
    started a topic Locking an IFS object

    Locking an IFS object

    Try the CHGDOCD command. Dave
Working...
X