ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Message CPFA09C Not authorized to object

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

  • Message CPFA09C Not authorized to object

    I know what you're thinking - pretty straightforward... that's what I thought too...

    I have a CL program that has the following at the beginning.

    CPYTOIMPF FROMFILE(QTEMP/&FNAME) TOSTMF(&IFSFILE) MBROPT(*REPLACE) +
    STMFCCSID(*STDASCII) RCDDLM(*CRLF) DTAFMT(*FIXED)

    &IFSFILE has value of /apps/clerk/T17170427

    Two lines later I have:

    RMVLNK OBJLNK(&IFSFILE)

    It is the RMVLNK statement that is generating the error (how can a program that creates a file, not have the authority to delete it)?

    The file is owned by the user running the program and the user has *RWX data authority. The program is owned by QSECOFR with User Profile of *OWNER - how does QSECOFR NOT have authority to the object?

    Color me confused...



  • #2
    Adopted authority does not work in the IFS -- never has. So it's not a question of QSECOFR having authority, it is the user.

    Its not clear why the user doesn't have authority. Possibly he/she has access to write data to existing files, but not access to delete them? You'd have to look and see what's happening.

    Comment


    • #3
      Well - I was getting the same error when compiled the standard way - program was owned by QPGMR and User profile of *USER , which is why I changed it...

      The three lines in question:

      CPYTOIMPF FROMFILE(QTEMP/&FNAME) TOSTMF(&IFSFILE) MBROPT(*REPLACE) +
      STMFCCSID(*STDASCII) RCDDLM(*CRLF) DTAFMT(*FIXED)
      SNDQJIFS DIR('/apps/clerk') STMF(&FNAME) DSTD('Title file to send to the +
      state.') MSG('Attached is the file that is to be uploaded to the +
      state.') TOINTNET(&EMAIL)
      RMVLNK OBJLNK(&IFSFILE)

      I create the file with CPYTOIMPF
      SNDQJIFS is a vendor utility that sends the file via email
      And finally RMVLNK

      It creates the file, sends it out via email, and removes it... well ... tries to remove it.

      Comment


      • #4
        What are the permissions on the file at the time the RMVLNK runs? Does the user have appropriate authority? And, is it possible that the SNDQJIFS program might be locking the object, preventing access?

        Comment


        • #5
          What authorities does the user have to the object? *OBJEXIST authority is required to delete it and *WX authority to the parent directory. There are several variables that can affect the authorities granted to objects in the /Root FS.

          Comment


          • #6
            You may also want to check the "Restricted rename and unlink" attribute.

            Cheers,

            Emmanuel

            Comment


            • #7
              Ok - the job creates the file using CPYTOIMPF so the user owns the file, has *RWX but none of the other authorities. How do I add that level of authority? Will CHGAUT work?

              Comment


              • #8
                Yes, CHGAUT and specify *ALL for the OBJAUT parameter.

                Cheers,

                Emmanuel

                Comment


                • #9
                  Great! Thank you for your assistance! Greatly appreciated.

                  Comment


                  • #10
                    You will get this error when you don't have file in IFS as well.
                    Suppose if RMLNK(' ') execute like this you will get same error. Debug your program and check IFS link parameter.

                    Comment


                    • #11
                      "You will get this error when you don't have file in IFS as well."

                      I don't believe that's correct - the error for object not found is: CPFA0A9

                      Cheers,

                      Emmanuel

                      Comment

                      Working...
                      X