ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

API(QUSRJOBI) get userLib list in variable

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

  • API(QUSRJOBI) get userLib list in variable

    Code:
          *  ===================================================================
          *  Get user lib list into variable
          *  ===================================================================
         D IntJobID        S             16    Inz( *Blank )
         D Format          S              8    Inz( 'JOBI0700' )
         D LibsToSkip      S             10I 0
         D Pos             S             10I 0
         D QualJobName     S             26    Inz ( '*' )
         D RcvVarLen       S             10I 0 Inz( %Len( RcvVar ) )
    
         d RcvVar          DS         32767
         d                               64    Inz( *Blank )
         d  NbrSysLibs                   10I 0 Inz( *Zero )
         d  NbrPrdLibs                   10I 0 Inz( *Zero )
         d  NbrCurLibs                   10I 0 Inz( *Zero )
         d  NbrUsrLibs                   10I 0 Inz( *Zero )
    
         d UsrLibs         ds           550
         d TheLibs                       11    dim(50)
    
          *
          * Program Info
          *
         d                SDS
         d  @PGM                   1     10
         d  @PARMS                37     39  0
         d  @JOB                 244    253
         d  @USER                254    263
         d  @JOB#                264    269  0
          *  -------------------------------------------------------------------
          *  - Retrieve job information                                        -
          *  -------------------------------------------------------------------
    
    
         c***                eval      QualJobName = @JOB    +
         c***                                        @USER   +
         c***                                        @JOB#
    
         c                   call      'QUSRJOBI'
         c                   parm                    Rcvvar
         c                   parm                    RcvVarLen
         c                   parm      'JOBI0700'    Format
         c                   parm      '*'           QualJobName
         c                   parm      *blanks       IntJobID
          *  -------------------------------------------------------------------
          *  - Extract user library list and return it to caller               -
          *  -------------------------------------------------------------------
         c                   eval      libsToSkip = NbrSysLibs +
         c                                          NbrPrdLibs +
         c                                          NbrCurLibs
    
         c                   eval      pos = ( LibsToSkip * 11 ) + 81
    
         c                   eval      usrLibs = %Subst(
         c                                               RcvVar          :
         c                                               Pos             :
         c                                               NbrUsrLibs * 11
         c                                             )
         c                   eval      *inlr = *on
    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: API(QUSRJOBI) get userLib list in variable

    Would you happen to have another version of this program that includes adding the system, product, and current library to the return variable?

    Comment


    • #3
      Re: API(QUSRJOBI) get userLib list in variable

      Chico this version will do that I just skip them..

      thats what this code does
      PHP Code:
      eval      pos = ( LibsToSkip 11 ) + 81 
      you would also have to adjust this to include the
      sys and prod libs

      though NbrCurLibs will always be 1
      PHP Code:
      NbrSysLibs+NbrUsrLibs+NbrCurLibs 11 
      please put in debug so you can see yourself...
      all the data is there I just skip 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: API(QUSRJOBI) get userLib list in variable

        Jamie,

        I attempted 2 modifications to the original code:

        eval pos = (NbrSysLibs + NbrUsrLibs +
        NbrCurLibs) * 11 + 81

        and

        eval pos = (NbrSysLibs + NbrUsrLibs +
        NbrCurLibs) * 11

        In each test in the debugger, I break at eval *inlr = *on and look at usrlibs. In each test I don't have all the libraries in my library list in the data structure.

        Thanks

        Comment


        • #5
          Re: API(QUSRJOBI) get userLib list in variable

          I think I figured it out. Please stand by.

          Comment


          • #6
            Re: API(QUSRJOBI) get userLib list in variable

            I misinterpreted the code that you initially sent. What I did was the following:

            eval pos = 81

            eval TotalLibs = (NbrSysLibs + NbrPrdLibs + NbrCurLibs + NbrUsrLibs) * 11

            And finally:
            eval usrLibs = %Subst(
            RcvVar :
            Pos :
            TotalLibs )

            That did it!

            Thanks for your help.

            Comment


            • #7
              Re: API(QUSRJOBI) get userLib list in variable

              great.....hope it helps

              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

              Working...
              X