Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Locking an IFS object

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

  • Locking an IFS object

    Try the CHGDOCD command. Dave

  • #2
    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

    Comment


    • #3
      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.

      Comment


      • #4
        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

        Comment


        • #5
          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

          Comment


          • #6
            Locking an IFS object

            Fair enough, thanks for being honest

            Comment


            • #7
              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

              Comment


              • #8
                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

                Comment


                • #9
                  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.

                  Comment


                  • #10
                    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.

                    Comment

                    Working...
                    X