-
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
-
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!)
-
Und die SQL-Funktion gibt es noch nicht so lange und für jedes Release (respektive TR).
-
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!)
-
Zitat von Fuerchau
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?
-
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.).
-
Brauche ich eigentlich den CMD dazu?
ich habe das Programm aufgerufen und bei mir ist immer
[/CODE]APIErrDS.QUSBAVL = 26
[/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;
-
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.
-
Danke, das war es.
Mit dem Libname habe ich das völlig übersehen
Similar Threads
-
By hdw2 in forum IBM i Hauptforum
Antworten: 0
Letzter Beitrag: 18-07-14, 14:27
-
By Bodo Roggenkamp in forum IBM i Hauptforum
Antworten: 4
Letzter Beitrag: 10-04-08, 12:11
-
By schramka in forum IBM i Hauptforum
Antworten: 0
Letzter Beitrag: 07-06-02, 09:41
-
By PS in forum IBM i Hauptforum
Antworten: 0
Letzter Beitrag: 14-02-02, 08:02
-
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
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks