ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Locks on IFS object

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

  • Locks on IFS object

    Hi,

    I'm using CALL PGM(QP0FPTOS) PARM(*LSTOBJREF &IFSPATH *FORMAT2) from within a CL to produce a spooled file for locks on an IFS object. I'm passing in the IFS path as a variable. Im getting a " Specified path could not be resolved to any system objects" error.

    The command works fine from the command line...

    Is anyone using this in a CL program or know why is wouldn't work?

    Thanks,

    Adam

  • #2
    Re: Locks on IFS object

    It's most likely the CL variable for the IFS path. I'm guessing its probably larger than 32 and you need to make sure the value gets passed to the API correctly. I would recommend using an RPG program to do this if you can.

    Comment


    • #3
      Re: Locks on IFS object

      The &IFSPATH variable is less than 32. The command works fine on the command line and the CL works just by putting the CALL inside a SBMJOB command. I don't know RPG hence the reason I'm working in CL...

      Comment


      • #4
        Re: Locks on IFS object

        create a command over this CL and then call it from the command.
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Locks on IFS object

          That is how I'm doing it. I have a WRKIFSLCK command with &IFSPATH as a parameter which is then calling a program which is failing with the "Specified path could not be resolved to any system objects" error. The command works fine on the command line.

          Comment


          • #6
            Re: Locks on IFS object

            Post your code. I did a quick test with and it worked fine. Are you sure your populating &IFSPATH correctly?

            Comment


            • #7
              Re: Locks on IFS object

              I have &IFSPATH set as '/adam/frubes1.csv'

              PGM PARM(&IFSPATH)

              /* Declare Variables */

              DCL VAR(&IFSPATH) TYPE(*CHAR) LEN(75)

              /* Call API to produce spooled file */

              CALL PGM(QP0FPTOS) PARM(*LSTOBJREF &IFSPATH +
              *FORMAT2)

              ENDPGM

              Comment


              • #8
                Re: Locks on IFS object

                Your &IFSPATH variable is 75, I already mentioned that that could be a problem. You should try what Jaime recommended. I'm on a 6.1 box and had problems using a variable larger than 32. I did have issues with running the API for a file in a folder through QNTC. Are there any other messages in your job log? That message is basically telling you it can't find the file so I would run it in debug and check the value of your variable and also make sure the file in question is actually there when you run the API.

                Comment


                • #9
                  Re: Locks on IFS object

                  Hi Adam:

                  Are you starting your path from the root?
                  key in "wrklnk '//' " at a command line then navigate to '/adam/frubes1.csv' ....use that full path as &ifspath

                  Best of Luck
                  GLS
                  Last edited by GLS400; March 25, 2013, 09:03 AM.
                  The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                  Comment


                  • #10
                    Re: Locks on IFS object

                    I find myself wondering how the API could possibly know the length of the &IFSPATH variable? I mean, sure, it's obvious in your source code, you can see the LEN(75). But the code that was written for the QP0FPTOS API couldn't possibly know what your source code looks like -- and it's being passed nothing but a pointer under the covers -- so how could it possibly know that your variable is 75 characters long??

                    My guess is that QP0FPTOS is a C program. When you call a C program from the command-line, the system automatically adds a x'00' (in C, this is called a "null-terminator") at the end of the string.

                    However, that won't happen when you pass a variable! So if you want to pass a variable, you need to do something like this:

                    Code:
                    DCL VAR(&IFSPATH) TYPE(*CHAR) LEN(75)
                    DCL VAR(&IFSPATHZ) TYPE(*CHAR) LEN(76)
                    DCL VAR(&NULL) TYPE(*CHAR) LEN(1) VALUE(x'00')
                    
                    
                    CHGVAR VAR(&IFSPATHZ) VALUE(&IFSPATH *TCAT &NULL)
                    Then pass &IFSPATHZ to the API (instead of &IFSPATH).

                    Now -- having said that, I did not test this at all -- it's 100% a guess off the top of my head. Worth a try, though!

                    Comment


                    • #11
                      Re: Locks on IFS object

                      Thanks Scott, that worked a treat!

                      Comment


                      • #12
                        Re: Locks on IFS object

                        &#$&#$&#$&#$ fine shooting from the hip Scott ...

                        [ e d i t ]
                        Mighty fine shooting from the hip Scott ...
                        [ / e d i t ]
                        Last edited by gcraill; March 31, 2013, 01:12 AM. Reason: because Jamie's a prude ...
                        Greg Craill: "Life's hard - Get a helmet !!"

                        Comment


                        • #13
                          Re: Locks on IFS object

                          Yeah, it was a guess... but, I couldn't think of anything else that would explain the symptoms, so... we'll call it an "educated guess" :-)

                          Comment

                          Working...
                          X