Midrange News for the IBM i Community


Posted by: Jeff Masak
IT Developer
The Boldt Co
Appleton, WI
Retrieving Library Lists in a Job Description
has no ratings.
Published: 27 Dec 2012
Revised: 23 Jan 2013 - 4103 days ago
Last viewed on: 17 Apr 2024 (7101 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Retrieving Library Lists in a Job Description Published by: Jeff Masak on 27 Dec 2012 view comments(7)

Is there a way to retrieve and print a libray list that is in a Job Description?  We are in the process of cleaning up Old Moldy Libraries on our system and want to find out if any of our job descriptions contain the libraries we want to delete.  Any help and/or example on how this could be done is appreciated.  I have looked at API QWDRJOBD but am not sure how to use it.  Thanks Jeff

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Retrieving Library Lists in a Job Description
Posted: 11 years 3 months 22 days 12 hours 10 minutes ago

I thought I had something on this in one of my bags of tricks, but I don't. Shouldn't be too difficult to do it yourself, however.

Posted by: TFisher
Premium member *
Comment on: Retrieving Library Lists in a Job Description
Posted: 11 years 3 months 18 days 3 hours 31 minutes ago

I use the QWdrJobD API (JOBD0100 Format) to retrieve the initial library list for job de!--script--ions. 

Posted by: jmasak
Premium member *
Appleton, WI
Comment on: Retrieving Library Lists in a Job Description
Posted: 11 years 3 months 16 days 15 hours 14 minutes ago

TFisher

 

Would you be able to post an example on how to use this API (QwdrjobD).

 

Thanks

Jeff

Posted by: Viking
Premium member *
CA
Comment on: Retrieving Library Lists in a Job Description
Posted: 11 years 3 months 16 days 13 hours 28 minutes ago

If you have TAATOOLS, this might give you what you need:

http://www.taatool.com//document/L_dspjobdlib.htm

 

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Retrieving Library Lists in a Job Description
Posted: 11 years 3 months 16 days 12 hours 20 minutes ago
Edited: Wed, 02 Jan, 2013 at 11:38:48 (4124 days ago)

This isn't beautiful, but it does exactly what you want.

 

     H DFTACTGRP(*NO) OPTION(*NODEBUGIO:*SRCSTMT) ACTGRP(*NEW)
     H EXTBININT(*YES)
     H BNDDIR('COZTOOLS/COZTOOLS')

      /include cozTools/qcpysrc,qusec
      /include cozTools/qcpysrc,apiProtos
      /include cozTools/qcpysrc,joblog
      /include qsysinc/qrpglesrc,qwdrjobd

     D apiData         S           5000A
     D pAPIData        S               *   Inz(%Addr(apiData))
     D jd              DS                  likeDS(QWDD0100)
     D                                     based(pAPIData)
     D libl            S             11A   DIM(255)
     D                                     based(pLibl)

     D apiError        DS                  likeDS(QUSEC_T) Inz
     D lib             S             11A

     D i               S             10I 0

     D entryPList      PR                  extPgm('DSPJDLIBL')
     D   jobd                        20A   Const
     D entryPList      PI
     D   jobd                        20A   Const

     C                   MOVE      *ON           *INLR
      /free
             // NOTE: I had to use QWDRJOBD2 prototype from COZTOOLS since
             //       IBM doesn't know how to name data Structures for RPG
             //       in the QSYSINC library.
            qwdrjobd2(apiData : %len(apiData) : 'JOBD0100' : jobD : apiError);
            if (apiError.QUSBAVL > 0); // Error?
               // failed, so return to caller
               return;
            endif;

            joblog('Job De!--script--ion  . . . . . . . %s': jd.qwdjdn);
            joblog('  Library  . . . . . . . . . . %s': jd.qwdjdln);
            joblog('Test de!--script--ion . . . . . . . %s': jd.qwdtd);
            joblog('Job Queue  . . . . . . . . . . %s': jd.qwdjqn00);
            joblog('  Library  . . . . . . . . . . %s': jd.qwdjqln00);
            joblog('Output Queue . . . . . . . . . %s': jd.qwdOQN);
            joblog('  Library  . . . . . . . . . . %s': jd.qwdOQLN);
            joblog('Log CL Programs  . . . . . . . %s': jd.qwdLCLP);
            joblog('Number of LIBL entries . . . . %s': %char(jd.qwdnlill));
            pLibl = %addr(apiData) + jd.qwdoill;
            for i = 1 to jd.qwdnlill;
               if (i = 1);
                 joblog('Library List Entries . . . . . %s': libl(i));
               else;
                 joblog('                               %s': libl(i));
               endif;
            endfor;
      /end-free 

 

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Retrieving Library Lists in a Job Description
Posted: 11 years 3 months 16 days 11 hours 38 minutes ago

Beat me by a few minutes, Bob. Jeff, do you understand Bob's code? It's fairly straightforward pointer arithmetic.

Posted by: jmasak
Premium member *
Appleton, WI
Comment on: Retrieving Library Lists in a Job Description
Posted: 11 years 3 months 16 days 7 hours 39 minutes ago

Got it and it works.  Thanks to all Jeff