ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

retrieve the source file/lib from object

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

  • retrieve the source file/lib from object

    Hi All:

    All of my cl programs were created using the crtbndcl command and most of my rpg programs were created using the crtbndrpg command. I am trying to progamatically retrieve the source file/library name of those objects. I know I can use the dsppgm pgm(mypgm) detail(*module) then option 5 to display the information that I'm looking for but I need it as a variable.

    I've looked at QBNRMODI but because of the way the programs were created the module does not exist.

    Any help in pointing me in the right direction would be appreciated.

    Thanks
    GLS
    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

  • #2
    Re: retrieve the source file/lib from object

    Will this work???



    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


    • #3
      Re: retrieve the source file/lib from object

      Hi Jamie:

      I don't see the source file/library name in the QCLRPGMI API.

      Any other thoughts?

      Thanks
      GLS
      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

      Comment


      • #4
        Re: retrieve the source file/lib from object

        Yes add 2 entries in the data structure ....

        start position 58 length of 10 = library
        and start pos 68 length of 10 = source file
        (maybe the other way around)
        You have to give me a break im working on microsoft server which
        is a much superior machine and its hard for me to think at a lower level

        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


        • #5
          Re: retrieve the source file/lib from object

          Hi Jamie:

          I think that works for OPM compiles not ILE. The results were blank.

          I think QBNLPGMI is the API I'm looking for. I found a sample program on IBM's site. I'll let you know how it turns out if you're interested.

          Thanks
          GLS
          The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

          Comment


          • #6
            Re: retrieve the source file/lib from object

            Try this then
            PHP Code:
                 d                SDS
                 d  
            @PGM                 001    010
                 d  
            @PARMS               037    039  0
                 d  
            @JOB                 244    253
                 d  
            @USER                254    263
                 d  
            @JOB#                264    269  0
                  
            *==============================================
                  *   
            QBNRMODI  API to Retrieve module info
                  
            *==============================================
                  *
                  * 
            Standard Parameters for QBNRMODI
                  
            * (RETRIEVE MODULE INFORMATION)
                  *
                 
            D RM_PARM         DS                  INZ
                 D  RM_RCV                 1    170                                         RECEIVER VARIABLE
                 D   RM_MODNAME            9     18                                         MODULE NAME
                 D   RM_MODLIB            19     28                                         MODULE LIBRARY
                 D   RM_MODATTR           29     38                                         MODULE ATTRIBUTE
                 D   RM_SRCFIL            52     61                                         SOURCE FILE
                 D   RM_SRCLIB            62     71                                         SOURCE LIBRARY
                 D   RM_SRCMBR            72     81                                         SOURCE MEMBER
                 D   RM_TEXT             121    170                                         TEXT DESCRIPTION
                 D  RM_RCV_LEN           171    174B 0                                      LENGTH OF RCV 
            VAR
                 
            D  RM_FORMAT            175    182                                         FORMAT NAME
                 D  RM_PGM_LIB           183    202                                         PGM NAME 
            LIBRARY
                 D   RM_PGM              183    192                                         PROGRAM NAME
                 D   RM_LIB              193    202                                         PROGRAM LIBRARY
                  
            *
                  * 
            Standard API error data structure
                  
            *
                 
            d APIERR          DS                  INZ
                 d  AEBYPR                 1      4B 0
                 d  AEBYAV                 5      8B 0
                 d  AEEXID                 9     15
                 d  AEEXDT                16    116
                  
            *
                  * 
            Define Variables
                  
            *
                 
            d InLibrary       S             10
                 d InModule        S             10
                  
            *
                 
            c                   clear                   RM_PARM
                 c                   
            eval      RM_RCV_LEN 170
                 c                   
            eval      RM_FORMAT  'MODI0100'
                 
            c                   eval      RM_PGM     InModule
                 c                   
            eval      RM_LIB     InLibrary
                 c                   clear                   APIERR
                 c                   
            eval      AEBYPR     116
                  
            *
                 
            c                   call      'QBNRMODI'
                 
            c                   parm                    RM_RCV
                 c                   parm                    RM_RCV_LEN
                 c                   parm                    RM_FORMAT
                 c                   parm                    RM_PGM_LIB
                 c                   parm                    APIERR
                  
            *
                 
            c                   eval      *INLR = *On
                  
            *
                  *==============================================
                  *   *
            Inzsr Initial onetime subroutine
                  
            *==============================================
                 
            csr   *Inzsr        begsr
                  
            *
                 
            c     *Entry        Plist
                 c                   parm                    InLibrary
                 c                   parm                    InModule
                  
            *
                 
            c                   endsr
                  
            *============================================== 
            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


            • #7
              Re: retrieve the source file/lib from object

              Though its a roundabout way why not try the following..

              PHP Code:
              DSPOBJD OBJ(MYLIB1/ *ALLOBJTYPE(*MODULEDETAIL(*SERVICEOUTPUT(*OUTFILEOUTFILE(QTEMP/OUTFILE1
              Once we have the outfile we can get the source name and the library name as well.
              Regards,
              KR

              Comment


              • #8
                Re: retrieve the source file/lib from object

                Originally posted by ReachKrishna View Post
                Though its a roundabout way why not try the following..

                PHP Code:
                DSPOBJD OBJ(MYLIB1/ *ALLOBJTYPE(*MODULEDETAIL(*SERVICEOUTPUT(*OUTFILEOUTFILE(QTEMP/OUTFILE1
                Once we have the outfile we can get the source name and the library name as well.
                That would work great if all the programs were OPM.

                In this case though GLS400 is looking at ile programs (it was mentioned in his first post) and that information is not available through DSPOBJD

                Comment


                • #9
                  Re: retrieve the source file/lib from object

                  I am not sure but when I tried the same on my system it worked. I could get the source name and the corresponding library name for all the modules in the specified library.
                  Regards,
                  KR

                  Comment


                  • #10
                    Re: retrieve the source file/lib from object

                    Ok this is what I came up with...

                    API QBNLPGMI will actually list place all module data into a user space. This includes source file/source library/ and member name.

                    The attached files are mostly from IBM's web site modified to pass 4 extra parms
                    source file/source library/member name/and print y/n. My modification will return parms for the first module only, and only when print is NOT requested.

                    If print is requested printyn=Y all module data will be printed (lib/file/mbr)
                    [edit]
                    this is rpg3 v5r2
                    [/edit]
                    Thanks to all for your help
                    GLS
                    Attached Files
                    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                    Comment


                    • #11
                      Re: retrieve the source file/lib from object

                      Hi ReachKrishna:

                      I used the crtbndcl command with all defaults. That will create the module in qtemp before creating the cl program. There is no module at this point so the dspobjd of the module fails

                      Thanks
                      GLS
                      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                      Comment


                      • #12
                        Re: retrieve the source file/lib from object

                        Got that now!!!
                        Sorry I got confused.
                        Regards,
                        KR

                        Comment

                        Working...
                        X