Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Calling RNM to rename an IFS object

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

  • Calling RNM to rename an IFS object

    hi all,

    i am trying to use RPG (free format, of course) to rename a file on the IFS.

    i build the command like this:

    Clear Cmd;
    Cmd = 'Rnm Obj(iseries/dir1/dir2/+
    dir4/dir5/images/uploaded/' + %Trim(Image) +
    ') +
    NewObj(' + %Trim(%Char(New_Num)) + %Trim(')');


    and i get this result:

    Rnm Obj(iseries/dir1/dir2/dir3/dir4/dir5/images/uploaded/114497.jpg) NewObj(250)

    then i call it with qcmdexec, but it don't work. i've already started PCO but i get the following error:

    Characters in qualifier beginning '114497.JPG' not valid.
    Error found on *N command.


    i am not changing the file type, just the name of the file.

    what am i missing?

    thanks in advance.

    -The Sergeant

  • #2
    2 things:
    When you run RNM from the command line, don't you surround the Obj value with apostrophes (')?
    Are you trying to rename using a relative path or an absolute path? At the moment it is relative, ie no leading slash (/)

    I am not sure what relevance starting PCO has to this action as it is not necessary for access to the IFS.
    Kevin

    Comment


    • #3
      hi kevin,

      i use this early on to build my command to display the image:

      Clear Cmd;
      Cmd = 'StrPcCmd PcCmd("\\as400\dir1\dir2\dir3\dir\4\dir5\images\uploaded\ ' + %Trim(Image) +
      '") Pause(*No)';
      qCmdExc(Cmd : %Len(Cmd));


      when i call the rnm from the command line, it does indeed put single-tic-marks around the command. is this a required wrapper?

      thanks.

      Comment


      • #4
        new issue.....kind of a stumper for me.

        i now use

        Clear Cmd;
        Cmd = 'StrPcCmd PcCmd(''ren \\as400\dir1\dir2\dir3\dir4\dir5\images\uploaded\' + %Trim(Image) + ' ' +
        %Trim(NewImage) + ''') Pause(*No)';
        qCmdExc(Cmd : %Len(Cmd));


        this renames the new file just fine, but the .jpg does not show up as an icon (image) unless you change the icons from medium to large (or the other way around).

        don't understand why that is. if i call the same command string from the command line, it works just fine and displays as a icon (image) without having to change icon-size.

        any ideas?

        -sergeant

        Comment


        • #5
          It sounds like you are losing the extension in the filename like .jpg. What are Image and NewImage. If you lose the extension the PC doesn't know what type of file it is.

          Comment


          • #6
            agreed that it is losing the type of extension, somehow, or at least seems to.

            i run the same command from the as/400 command line, and the extension is NOT lost. the image shows as a .jpg and the icon is the actual image, not the default "ms cloud".

            when i run the same command, build in rpg/free and use qcmdexec to call StrPcCmd, that is when it loses it's bearings.

            -sergeant

            Comment


            • #7
              What does the command look like in debug right before you execute it, my guess is that something maybe isn't exactly like the one executed manually.

              Comment


              • #8
                From Debug:

                StrPcCmd PcCmd('Ren \\as400\dir1\dir2\dir3\dir4\images\uploaded\103611 .jpg 3.jpg'
                ) Pause(*Yes)


                From Command Line:

                STRPCCMD PCCMD('Ren \\as400\dir1\dir2\dir3\dir4\images\uploaded\114497 .jpg
                3.jpg')


                I dont see any differences. maybe your Eagle-Eyes will.

                thanks.

                -sergeant
                Last edited by Sergeant; 10-11-2013, 12:41 PM.

                Comment

                Working...
                X