ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Retreving library list using API 'QWRDJOBD'

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

  • Retreving library list using API 'QWRDJOBD'

    Hi All,

    Iam trying to retrieve the library list using the API QWRDJOBD.but iam unable to get it.

    Could anyone explain the usage of this API in RPGLE for retreving the Library list.

    Thks,
    Susan.

  • #2
    Re: Retreving library list using API 'QWRDJOBD'

    Code:
         H DFTACTGRP(*NO) OPTION(*SRCSTMT : *NODEBUGIO)
         H COPYRIGHT('(c) 2006 - Robert Cozzi, Jr. - All rights reserved.')
    
          *************************************************************
          **  RTVJOBD - Retrieve Job Description Command Proc Pgm.
          **            This program returns the library list
          **            of the specified Job Description ("jobd").
          **            In addition, the number of library names
          **            in the jobd's library lis is also returned.
          **            See the associated RTVJOBD CMD source for use
          **            in CL.  TIP: The return variables in your CL
          **            program should be defined as follows:
          **               DCL &LIBL    TYPE(*CHAR) LEN(2750)
          **               DCL &LIBLCNT TYPE(*INT)  LEN(2)
    
         D RtvJobD         PR
         D  szJobD                       20A   Const
         D  rtnLIBL                    2750A
         D  rtnLIBLCount                  5I 0
    
         D RtvJobD         PI
         D  szJobD                       20A   Const
         D  rtnLIBL                    2750A
         D  rtnLIBLCount                  5I 0
    
    
          /COPY QSYSINC/QRPGLESRC,QWDRJOBD
          /COPY QSYSINC/QRPGLESRC,QUSEC
    
          **  Retrieve Job Description
         D*QWDRJOBD        PR                  ExtPgm('QWDRJOBD')
         D RtvJobDAPI      PR                  ExtPgm('QWDRJOBD')
         D  szRtnBuffer               65535A   OPTIONS(*VARSIZE)
         D  nRtnBufLen                   10I 0 Const
         D**  Specify 'JOBD0100'
         D  apiFormat                     8A   Const
         D  JobD                         20A   Const
         D  api_error                          LikeDS(QUSEC)
    
         D JobD            DS                  LikeDS(QWDD0100)
         D                                     Based(pJobD)
    
         D JobDInfo        DS                  LikeDS(QWDD0100)
    
         D LibList         S             11A   Based(pLIBL) DIM(250)
         D LibL            S           2750A   Based(pLIBL)
         D APIErrDS        DS                  LikeDS(QUSEC)
    
         C                   eval      *INLR = *ON
    
          **  Sadly, with this API, we need to call it twice when
          **  the LIBL is needed.
          **  First call: Get the length of the data to be returned.
         C                   eval      APIErrDS= *ALLX'00'
         C                   eval      APIErrDS.QUSBPRV = %size(APIErrDS)
         C                   eval      JobDInfo = *ALLX'00'
         C                   callp     RtvJobDAPI(JobDInfo : %size(JobDInfo):
         C                                     'JOBD0100': szJOBD : APIErrDS)
    
         C                   if        APIErrDS.QUSBAVL = 0
         C                   eval      pJobD = %Alloc(JobDInfo.QWDBAVL)
         C                   eval      JOBD = *ALLX'00'
          **  Second call: Get the library list.
         C                   callp     RtvJobDAPI(JOBD : JobDInfo.QWDBAVL :
         C                                     'JOBD0100': szJOBD : APIErrDS)
         C                   if        %Parms >= 3
         C                   eval      rtnLIBLCount = JobD.QWDNLILL
         C                   endif
         C                   if        %Parms >= 2
          /free
            pLibl = pJobD + JobD.QWDOILL;
            rtnLibl = %subst(LIBL:1:JobD.QWDNLILL*%size(LibList));
          /end-free
         C                   endif
         C                   deAlloc                 pJobD
         C                   endif
    Wait a just minute, I post some articles about it too !

    Comment


    • #3
      Re: Retreving library list using API 'QWRDJOBD'

      Rechecking the links took some time, but here are the articles anyway !

      download: The API book: click here !

      APIs by Example: Retrieve Job's User Library List : click here !


      The QWDRJOBD API returns the entire job description information, including the library list. But to make things work correctly, we have to ensure that the return structure is large enough to handle the fixed values returned by the API as well as the variable length elements, such as the library list. Read more about it : click here !

      Before you delete a library or other objects that may be used by your job descriptions, wait. Your job descriptions may not work properly after you perform the deletion. Quickly determine the job descriptions that reference a library or other objects with the utility contained in this article.Read more about it : click here !

      How to use some Api's (with sourcecodes): click here !

      Click it and Read It !

      Comment


      • #4
        Re: Retreving library list using API 'QWRDJOBD'

        without the copy books just a search away in the forum:



        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: Retreving library list using API 'QWRDJOBD'

          Hi All,

          I used the above mentioned code only to retrieve initial library list. In main program i used the following code.

          c 'DEFAULTJD ' CAT 'SYSGPL' szJobd1
          c CALLP rtvjobd(szJobd1:rtnLibl1:rtnliblcount1)

          If Job Description is DEFAULTJD and Library is SYSGPL, then only it is retrieving LIBL, for other JOBDs and libraries it is not working.
          Could any one please suggest me how to retrieve LIBL for other libraries and JOBDescriptions also.


          Thanks,
          Pawan

          Comment


          • #6
            Re: Retreving library list using API 'QWRDJOBD'

            OK .. I have gotten this to compile, but when it performs the first RtvJobDAPI, it returns an APIErr.QUSEI = 'CPF9810' (Library Not Found)

            I'm passing as the szJobD to find as 'QGPL ASHSCANJD ' (20 spaces Library/JobD).

            How can it NOT find the QGPL library? Or, should this be 'QGPL/ASHSCANJB'? (which I can't get to work either)

            Anyone??

            Comment


            • #7
              Re: Retreving library list using API 'QWRDJOBD'

              its 20 long and may be object then library first depending on api .... so ' QGPLxxxxxxASHSCANJB'
              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


              • #8
                Re: Retreving library list using API 'QWRDJOBD'

                Wow .. there goes the assumption that Library goes before Object. Hmmmmm.....

                Thanks Jamie!

                Comment


                • #9
                  Re: Retreving library list using API 'QWRDJOBD'

                  no problem...I may be wrong but, Im on vacation so I get a pass right????
                  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


                  • #10
                    Re: Retreving library list using API 'QWRDJOBD'

                    Originally posted by FaStOnE View Post
                    Wow .. there goes the assumption that Library goes before Object. Hmmmmm.....

                    Thanks Jamie!
                    That's what happens when they let PC developers code the api's for our system.
                    Michael Catalani
                    IS Director, eCommerce & Web Development
                    Acceptance Insurance Corporation
                    www.AcceptanceInsurance.com
                    www.ProvatoSys.com

                    Comment


                    • #11
                      Re: Retreving library list using API 'QWRDJOBD'

                      no for APIs it's the same as commands, the object parms are actually recieved in the CPP as object (10 char padded with blanks) and the library (10 char padded with blanks)
                      I'm not anti-social, I just don't like people -Tommy Holden

                      Comment

                      Working...
                      X