[NEWSboard IBMi Forum]
  1. #1
    Registriert seit
    Apr 2012
    Beiträge
    360

    SQL Libarlist info von einer JOBD

    Hallo,

    die aktuelle Bibliotheksliste kann ich mir ja mit Sql holen:
    Code:
    SELECT ORDINAL_POSITION AS POS, SYSTEM_SCHEMA_NAME AS LIBRARY,
    TYPE, CAST(TEXT_DESCRIPTION AS CHAR(50)) AS TEXT 
    FROM QSYS2.LIBRARY_LIST_INFO
    Wie kann ich eine bestimmte Jobdescription abfragen?

    lg

  2. #2
    Registriert seit
    Jun 2001
    Beiträge
    1.975
    ist zwar kein SQL aber geht seit Jahren ...

    DCL &UL *CHAR 2750
    DCL &ANZ *CHAR
    RTVJOBD JOBDT(LIB/JOBD) RTNLIB(&UL) RTNANZ(&ANZ)

    Robi
    Das Notwendige steht über dem technisch machbaren.
    (klingt komisch, funktioniert aber!)

  3. #3
    Registriert seit
    Feb 2001
    Beiträge
    20.241
    Und die SQL-Funktion gibt es noch nicht so lange und für jedes Release (respektive TR).
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  4. #4
    Registriert seit
    Jun 2001
    Beiträge
    1.975
    Oh, das ding ist gar nicht vom OS

    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 RtvJobDCL       PR                                               
    D  szJobD                       20A   Const                        
    D  rtnLIBL                    2750A                                
    D  rtnLIBLCount                  5I 0                              
                                                                       
    D RtvJobDCL       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
    und

    Code:
                 CMD        PROMPT('Liblist v.Jobd lesen RTBJOBD')      
                 PARM       KWD(JOBDT) TYPE(QUAL1)  +                   
                              PROMPT('JOBD')                            
                 PARM       KWD(RTNLIB) TYPE(*CHAR) LEN(2750) +         
                              RTNVAL(*YES) CHOICE('VAR FÜR LIBL (CHAR + 
                              2750)')                                   
                 PARM       KWD(RTNANZ) TYPE(*INT2) RTNVAL(*YES) +      
                              CHOICE('VAR FÜR ANZAHL (*CHAR )')         
     QUAL1:      QUAL       TYPE(*NAME)                                 
                 QUAL       TYPE(*NAME)     PROMPT('LIB') DFT('     ')
    Das Notwendige steht über dem technisch machbaren.
    (klingt komisch, funktioniert aber!)

  5. #5
    Registriert seit
    Apr 2012
    Beiträge
    360
    Zitat Zitat von Fuerchau Beitrag anzeigen
    Und die SQL-Funktion gibt es noch nicht so lange und für jedes Release (respektive TR).
    Hätten Sie ein Beispiel von so einer Abfrage?

  6. #6
    Registriert seit
    Feb 2001
    Beiträge
    20.241
    Das war die falsche Antwort, da ich auch überlesen hatte, dass eine JOBD und nicht der aktuelle Job gemeint war.
    Nimm einfach die Quellen von Robi (s.o.).
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  7. #7
    Registriert seit
    Apr 2012
    Beiträge
    360
    Brauche ich eigentlich den CMD dazu?

    ich habe das Programm aufgerufen und bei mir ist immer

    [/CODE]
    APIErrDS.QUSBAVL = 26
    Click image for larger version. 

Name:	2017-06-28 10_36_20-Sitzung C - [24 x 80].png 
Views:	6 
Size:	5,3 KB 
ID:	389
    [/CODE]

    Code:
    
    
    Code:
                                                                                                        
         H DFTACTGRP(*NO) OPTION(*SRCSTMT : *NODEBUGIO)                                                 
                                                                                                        
          //************************************************************                                
          // 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.                                                                           
                                                                                                        
          ** D/COPY HJISRC/QCpySrc,GetLibLR                                                             
                                                                                                        
         D GETLIBLR        PR                  ExtPgm('GETLIBLR')                                       
         D  szJobD                       20A   Const                                                    
         D  rtnLIBL                    2750A                                        Options             
         D  rtnLIBLCount                  5I 0                                      (*Nopass : *Omit)   
         D*                                                                                             
         D GetLibLR        PI                                                                           
         D  szJobD                       20A   Const                                                    
         D**rtnLIBL                    2750A   Options(*Nopass : *Omit)                                 
         D  rtnLIBL                    2750A                                                            
         D  rtnLIBLCount                  5I 0                                                          
                                                                                                        
         D/COPY QSYSINC/QRPGLESRC,QWDRJOBD                                                              
         D/COPY QSYSINC/QRPGLESRC,QUSEC                                                                 
                                                                                                        
          // Retrieve Job Description                                                                   
         D RtvJobDAPI      PR                  ExtPgm( 'QWDRJOBD' )                                     
         D  szRtnBuffer               65535A   OPTIONS( *VARSIZE )                                      
         D  nRtnBufLen                   10I 0 Const                                                    
                                                                                                        
          // 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 )                                          
                                                                                                        
          /FREE                                                                                         
           *INLR = *ON;                                                                                 
                                                                                                        
           // Sadly, with this API, we need to call it twice to get the LibL                            
           // First call: Get the length of the data to be returned.                                    
                                                                                                        
           APIErrDS         = *ALLX'00';                                                                
           APIErrDS.QUSBPRV = %size( APIErrDS );                                                        
           JobDInfo         = *ALLX'00';                                                                
           RtvJobDAPI( JobDInfo                                                                         
                     : %size( JobDInfo )                                                                
                     : 'JOBD0100'                                                                       
                     : szJOBD                                                                           
                     : APIErrDS );                                                                      
                                                                                                        
           If APIErrDS.QUSBAVL = 0;                                                                     
                                                                                                        
              pJobD = %Alloc( JobDInfo.QWDBAVL );                                                       
              JOBD = *ALLX'00';                                                                         
                                                                                                        
           // Second call: Get the library list.                                                        
              RtvJobDAPI( JOBD                                                                          
                        : JobDInfo.QWDBAVL                                                              
                        : 'JOBD0100'                                                                    
                        : szJOBD                                                                        
                        : APIErrDS );                                                                   
              If %Parms >= 3;                                                                           
                 rtnLIBLCount = JobD.QWDNLILL;                                                          
              EndIF;                                                                                    
                                                                                                        
              If %Parms >= 2;                                                                           
                 pLibl   = pJobD + JobD.QWDOILL;                                                        
                 rtnLibl = %subst( LIBL : 1 : JobD.QWDNLILL * %size( LibList ) );                       
                                                                                                        
              EndIF;                                                                                    
              DeAlloc pJobD;                                                                            
           EndIF;


  8. #8
    Registriert seit
    Feb 2001
    Beiträge
    20.241
    Mach mal eine DSPMSGD CPF9810, ich meine das heißt "Objekt nicht gefunden".
    Bedenke die Aufrufparameter!
    Die JOBD wird in der Form "JOBDxxxxxxLIBNAMExxx" übergeben.
    Der letzte Parameter muss 2750 Zeichen lang sein!
    Von der Kommandozeile geht das nicht.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  9. #9
    Registriert seit
    Apr 2012
    Beiträge
    360
    Danke, das war es.
    Mit dem Libname habe ich das völlig übersehen

Similar Threads

  1. 3488 Info Window II
    By hdw2 in forum IBM i Hauptforum
    Antworten: 0
    Letzter Beitrag: 18-07-14, 14:27
  2. SPL-Info's in DTAQ's
    By Bodo Roggenkamp in forum IBM i Hauptforum
    Antworten: 4
    Letzter Beitrag: 10-04-08, 12:11
  3. Visual Info (WAF)
    By schramka in forum IBM i Hauptforum
    Antworten: 0
    Letzter Beitrag: 07-06-02, 09:41
  4. Info zu IXA
    By PS in forum IBM i Hauptforum
    Antworten: 0
    Letzter Beitrag: 14-02-02, 08:02
  5. QUERY Info
    By awellen in forum IBM i Hauptforum
    Antworten: 2
    Letzter Beitrag: 14-12-01, 13:02

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • You may not post attachments
  • You may not edit your posts
  •