Está en la página 1de 7

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD.

Cantidad de Objetos en una librera

Http://iseriesvenezuela.blogspot.com

Autor: Ing: Liliana Surez

API: QLIRLIBD
Cantidad de Objetos en una LIBRERIA

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera A veces requerimos saber cuantos objetos tiene una librera hay una API en el iseries que permite determinar el numero de objetos que estamos buscando. A continuacin dos ejemplos de uso de la API. El primer desarrollo es corto y arroja informacin general de la librera. El Segundo Cdigo fuente si devuelve, entre otros datos, la cantidad de objetos. Puedes descargar los fuentes en este enlace https://skydrive.live.com/?cid=F974C7D5A177A2FA&id=F974C7D5A177A2FA!119 Puedes ver el cdigo fuente del archivo de los dos programas a continuacin:

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera Enlace Original: http://www.think400.dk/apier_2.htm#eks0016

Este Primer Cdigo no suministra la cantidad de objetos de una librera pero es sencillo de entender. Arroja informacin general de una librera En el campo &ODOBNM debes colocar el nombre de la librera
http://www.think400.dk/apier_2.htm#eks0016 Retrieve library description It is used in a loop based on DSPOBJD *ALL *LIB OUTPUT(*OUTFILE). It puts the library name, size, and description to your joblog. PGM dcl &rtnvar *char 104 dcl &rtnlen *char 4 x'00000068' dcl &attrib *char 12 x'000000020000000500000006' dcl &desc *char 50 dcl &size *dec (9 0) dcl &mult *dec (9 0) dcl &sizedec *dec (15 0) dcl &sizechar *char 15 call qlirlibd (&rtnvar + &rtnlen + &odobnm + &attrib + x'0000000000000000') chgvar &desc %sst(&rtnvar 29 50) chgvar &size %bin(&rtnvar 93 4) chgvar &mult %bin(&rtnvar 97 4) chgvar &sizedec (&size * &mult) chgvar &sizechar &sizedec sndpgmmsg (&odobnm *cat ' ' *cat &sizechar + *cat ' ' *cat &desc) ENDPGM Thanks to Vern Hamberg

Enlace Original: http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera http://www912.ibm.com/8625680A007CA5C6/0/C0CE14CE4349FAFF862567FB0071DF80? Open&Highlight=2,QLIRLIBD

Este segundo cdigo si devuelve la cantidad de objetos que hay en una librera. La Variable LIBCNT devuelve el nro de objetos de la librera */ Debes pasar por parmetro el nombre de la librera al invocar este programa
/*******************************************************************/ /* La Variable LIBCNT devuelve el nro de objetos de la librera */ /* MODULE NAME: RTVLAPI */ /* */ /* FUNCTION: */ /* This test program uses the "Retrieve Library */ /* Description" API, QLIRLIBD, to return both */ /* the number of objects in the library and the */ /* library size. */ /* */ /* INPUT: */ /* */ /* PARAMETER LIST: */ /* */ /* #1 LIBNAME The library name for which information */ /* is being returned. */ /* */ /* No special values such as *CURLIB are */ /* allowed. */ /* */ /* OUTPUT: The information returned by the QLIRLIBD */ /* is output to the display with several */ /* messages. An example of the output for library CAROL:*/ /* */ /* Info for library CAROL */ /* # of objects in library 000000000000004 */ /* Library size 000000000569344 */ /* Library size multiplier 000000000000001 */ /* Size of all objects used in library size */ /* */ http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera /* Following is a further description of the output: */ /* - Library size */ /* - The size of the library object and all of the */ /* objects in the library in units of the library */ /* size multiplier. */ /* - Library size multiplier */ /* - The value used to multiply the library size by */ /* to get the total library size. Values returned: */ /* 1 The library size is smaller than */ /* 1,000,000,000 bytes. */ /* 1024 The library size is between */ /* 1,000,000,000 and */ /* 1,024,000,000,000 bytes */ /* 1048576 The library size is larger than */ /* 1,024,000,000,000 bytes */ /* - Message indicating that "Size of all objects */ /* used in library size". */ /* */ /* Indicates that there were no objects locked and */ /* the user had some authority to all of the objects. */ /* If some objects were locked or the user didn't */ /* have authority, you would see messages: */ /* */ /* "Some objects locked or not authorized." */ /* "Library size does not include all objects." */ /* */ /*******************************************************************/ PGM PARM(&LIBNAME) /* . . . . . . . . Define Program Variables . . . . . . . . . */ /* Parameters */ DCL VAR(&LIBNAME) TYPE(*CHAR) LEN(10) /* Message to display to user */ DCL VAR(&MSG) TYPE(*CHAR) LEN(103) /* Variables for calling QLIRLIBD API */ DCL VAR(&BYTESP) TYPE(*DEC) LEN(8) VALUE(0) DCL VAR(&KEY1) TYPE(*DEC) LEN(8) DCL VAR(&KEY2) TYPE(*DEC) LEN(8) DCL VAR(&LIBSIZ) TYPE(*DEC) LEN(15 0) DCL VAR(&LIBSIZM) TYPE(*DEC) LEN(15 0) DCL VAR(&LIBCNT) TYPE(*DEC) LEN(15 0) DCL VAR(&NBRVARREC) TYPE(*DEC) LEN(8) DCL VAR(&RCVLD) TYPE(*DEC) LEN(8) VALUE(200) DCL VAR(&ERRCODE) TYPE(*CHAR) LEN(4) DCL VAR(&INFSTAT) TYPE(*CHAR) LEN(1) DCL VAR(&RCVL) TYPE(*CHAR) LEN(4) DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(200) http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera DCL VAR(&RTVINFO) TYPE(*CHAR) LEN(16) /* Variables for decimal to character conversion DCL VAR(&CHARCNV) TYPE(*CHAR) LEN(15) */

/* Set up to call the API: */ /* Parms */ /* - RCVVAR Receiver variable to receive the information */ /* - RCVL Length of the receiver variable */ /* - LIBNAME Library name to return info for */ /* - RTVINFO Defines attributes of library to retrieve */ /* - NBRVARREC Number of keys requested. Two keys */ /* are requested */ /* - KEY1 Return info for key 6, library size. */ /* - KEY2 Return info for key 7, number of objects in lib. */ /* */ CHGVAR VAR(&KEY1) VALUE(6) CHGVAR VAR(&KEY2) VALUE(7) CHGVAR VAR(&NBRVARREC) VALUE(2) CHGVAR VAR(%BIN(&RTVINFO 1 4)) VALUE(&NBRVARREC) CHGVAR VAR(%BIN(&RTVINFO 5 4)) VALUE(&KEY1) CHGVAR VAR(%BIN(&RTVINFO 9 4)) VALUE(&KEY2) CHGVAR VAR(%BIN(&ERRCODE)) VALUE(&BYTESP) CHGVAR VAR(%BIN(&RCVL)) VALUE(&RCVLD) /* Call the QLIRLIBD API */ CALL PGM(QLIRLIBD) PARM(&RCVVAR &RCVL &LIBNAME &RTVINFO &ERRCODE) /* Process the information returned by the QLIRLIBD API. */ /* Return info about library size, key 6. */ CHGVAR VAR(&KEY1) VALUE(%BIN(&RCVVAR 21 4)) CHGVAR VAR(&LIBSIZ) VALUE(%BIN(&RCVVAR 29 4)) CHGVAR VAR(&LIBSIZM) VALUE(%BIN(&RCVVAR 33 4)) CHGVAR VAR(&INFSTAT) VALUE(%SST(&RCVVAR 37 1)) /* Return info about count of objects, key 7. */ CHGVAR VAR(&KEY2) VALUE(%BIN(&RCVVAR 45 4)) CHGVAR VAR(&LIBCNT) VALUE(%BIN(&RCVVAR 53 4)) /*********************************************************************/ /* Display info returned from QLIRLIBD API */ /*********************************************************************/ CHGVAR VAR(&MSG) + VALUE('Info for library ') CHGVAR VAR(%SST(&MSG 32 10)) VALUE(&LIBNAME) SNDPGMMSG MSG(&MSG) /* Convert the decimal values returned to character values */ CHGVAR VAR(&CHARCNV) VALUE(&LIBCNT) http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera CHGVAR VAR(&MSG) + VALUE('# of objects in library ') CHGVAR VAR(%SST(&MSG 32 15)) VALUE(&CHARCNV) SNDPGMMSG MSG(&MSG) /* Convert the decimal values returned to character values */ CHGVAR VAR(&CHARCNV) VALUE(&LIBSIZ) CHGVAR VAR(&MSG) + VALUE('Library size ') CHGVAR VAR(%SST(&MSG 32 15)) VALUE(&CHARCNV) SNDPGMMSG MSG(&MSG) /* Convert the decimal values returned to character values */ CHGVAR VAR(&CHARCNV) VALUE(&LIBSIZM) CHGVAR VAR(&MSG) + VALUE('Library size multiplier ') CHGVAR VAR(%SST(&MSG 32 15)) VALUE(&CHARCNV) SNDPGMMSG MSG(&MSG) /* Check if the library size includes all objects in the library. */ IF (&INFSTAT = '1') THEN(DO) CHGVAR VAR(&MSG) + VALUE('Size of all objects used in library size.') SNDPGMMSG MSG(&MSG) ENDDO ELSE DO SNDPGMMSG MSG('Some objects locked or not authorized.') SNDPGMMSG MSG('Library size does not include all objects.') ENDDO ENDPGM

http://iseriesvenezuela.blogspot.com Autora: Ing. Liliana Surez. Api: QLIRLIBD. Cantidad de Objetos en una librera

También podría gustarte