ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

The rename object API QLIRNMO

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

  • The rename object API QLIRNMO

    The rename object API QLIRNMO


    Ibm Says:

    Required Parameter Group

    From qualified object name

    INPUT; CHAR(20)
    The object being renamed and the library in which it is located.
    The first 10 characters contain the object name, and the second
    10 characters contain the library name. You can use these special
    values for the library name:


    *CURLIB
    The job's current library

    *LIBL
    The job's library list

    Object type
    INPUT; CHAR(10)
    The type of object being renamed. If the from object and the to
    object belong to the same library, only a rename operation is done.
    The object type must be supported on the RNMOBJ command. If the
    from object and the to object belong to different libraries, a move
    operation is done. The object type must be supported on the MOVOBJ
    command. If both a rename and a move operation are done, the object
    type must be supported on both the RNMOBJ and MOVOBJ commands.
    An asterisk (*) must precede the object type. For a list of the
    object types that cannot be moved or renamed, see the CL Programming
    book.


    To qualified object name
    INPUT; CHAR(20)
    The new name of the object and the new library in which it will be
    located. The object name can be the same name as the original object
    or a new name. The library name can be the same name as the original
    library or a new name. If the object name is the same as the original
    object, the library name must not be the same as the original library.
    The first 10 characters contain the object name, and the second 10
    characters contain the library name.


    Replace object
    INPUT; CHAR(1)
    Whether to replace an existing object with the same name as the to object
    and library name parameter. The following values can be specified:


    0
    Do not replace the existing object. If 0 is specified and the object already
    exists, an error message is returned to the application.

    1
    Replace the existing object.

    Error code
    I/O; CHAR(*)

    PHP Code:

    The API 

          
    PROGRAM - @RENAME
          
    PURPOSE rename object use API QLIRNMO
          
    WRITTEN -
          * 
    AUTHOR  -

          * 
    PROGRAM DESCRIPTION
          
    *--------------------------------------------------------
          *
          * 
    Entry Plist
          
    *
         
    @RENAME         pr
         d  OldFile                      10
         d  OldLib                       10
         d  NewFile                      10
         d  NewLib                       10
         d  inType                       10
          
    *
         
    @RENAME         pi
         d  OldFile                      10
         d  OldLib                       10
         d  NewFile                      10
         d  NewLib                       10
         d  inType                       10
          
    *
          * 
    Variable Definition
          
    *
         
    d Error           s             34
         d FromObject      s             20
         d ObjectType      s             10
         d ToObject        s             20
         d Replace         s              1
          
    *
          * 
    Program Info
          
    *
         
    d                SDS
         d  
    @PGM                 001    010
         d  
    @PARMS               037    039  0
         d  
    @MSGDTA               91    170
         d  
    @MSGID               171    174
         d  
    @JOB                 244    253
         d  
    @USER                254    263
         d  
    @JOB#                264    269  0
           //
           //  external calls
           //
         
    d $Rename         pr                  extpgm('QLIRNMO')
         
    d   fromObject                  20
         d   ObjectType                  10
         d   ToObject                    20
         d   Replace                      1
         d   Error                       34

          
    /Free

            
    //--------------------------------------------------------
            // MAIN LINE
            //--------------------------------------------------------


                       // take parms and rename --and/or-- move object

                    
    FromObject OldFile OldLib;
                    
    ToObject NewFile NewLib;
                    
    ObjectType InType;
                    
    replace '1';
                    
    $rename(FromObject ObjectType ToObject Replace Error);


                   *
    inlr = *on;


            
    //--------------------------------------------------------
            // *Inzsr -  one time run subroutine
            //--------------------------------------------------------

                 
    begsr *inzsr;


                 
    endsr;
          /
    End-Free 
    Attached Files
    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

  • #2
    Re: The rename object API QLIRNMO

    Hello,

    I'm trying to compile this and receive the error RNF3751 - External procedure on prototype for main procedure is not same as actual external name.

    Is there any special compile options needed?

    Please advise.

    Thanks.

    Comment


    • #3
      Re: The rename object API QLIRNMO

      Make sure that what ever you name your program
      you name the entry plist PR & PI

      so whatever you called your program replace the @RENAME with the name of your program.


      thats it...

      jamie
      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


      • #4
        Re: The rename object API QLIRNMO

        Also remember that any external procedure/program names are case-sensitive. Use all CAPS

        Comment


        • #5
          Re: The rename object API QLIRNMO

          Jamie, Thanks for the quick response. As I mentioned earlier, the performance for this is a big improvement.
          Jim
          Jim Waymire

          Comment


          • #6
            Re: The rename object API QLIRNMO

            thanks everyone. After changing my program name to the @RENAME value, it compiled...and worked.

            Comment

            Working...
            X