对400的误解之一。LIBRARY内所有OBJECTS占磁盘空间的大小
某公司电脑部主管让小张看一下他们的数据库占空间多大了。
小张就用cl command:
DSPOBJD OBJ(DB_LIB) OBJTYPE(*LIB)
然后便说:10兆!
主管怎么也想不通怎么可能只有10兆,可是小张自称是400专家,不可能会搞错的。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
这个BBS把 8)显示成
很讨厌
换成小写就可以了。
Thanks to Vern Hamberg
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.
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)
found this monster @ IBM itself ... hmmmm
http://www-912.ibm.com/8625680A007CA...ght=2,QLIRLIBD
IBM Software Technical Document
__________________________________________________________________
Document Information
Document Information
Document Number: 17284402
Functional Area: Operating System
Subfunctional Area: Library Lists/Librarian
Sub-Subfunctional Area: General
OS/400 Release: V4R5M0; V5R1M0; V5R2M0; V5R3M0; V5R4M0
Product: Operating System/400 - OS/400 WORK MGMT (5769SS1WM)
OS/400 WORK MGMT (5722SS1WM)
Product Release: N/A
__________________________________________________________________
Document Title
CL Program to Retrieve Library Size and Number of Objects
Document Description
This provides the listing of a CL program that can be called from the command line to obtain the number of objects in a library and the size of the library. Assuming the program is creating with program name RTVLAPI, the program can be called. On the operating system command line, type the following:
/*******************************************************************/
/* */
/* 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 */
/* */
/* 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( VALUE(0)
DCL VAR(&KEY1) TYPE(*DEC) LEN(
DCL VAR(&KEY2) TYPE(*DEC) LEN(
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(
DCL VAR(&RCVLD) TYPE(*DEC) LEN( 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)
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)
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
getlsiz.zip (16.3 KB, 41 views):
http://www.code400.com/forum/att ... 20&d=1208195395
Create the following CL program named for example DSPLIBSIZE
Pgm Parm(&Lib)
dcl &Lib *char len(10)
dcl &Size *dec len(15)
dcl &MbSize *dec len(9 3)
dcl &MbSize_ *char len(9)
dcl &Mega *dec len(15) value(1048576)
Dclf QADSPOBJ
* Display Object Description for all objects in the library into "LibSize" in qtemp */
DspObjD Obj(&Lib/*All) ObjType(*All) OutPut(*OutFile) OutFile(Qtemp/LibSize)
OvrDbf File(QADSPOBJ) ToFile(Qtemp/LibSize)
/* Loop through all the records in the file af add object size to &Size */
Loop:
Rcvf
MonMsg (cpf0000) exec(goto eof)
ChgVar &Size (&Size + &OdObSz)
goto loop
Eof:
/* Calculate mega bytes */
ChgVar &MbSize (&Size / &Mega)
ChgVar &MbSize_ &MbSize /* Convert to char */
SndPgmMsg MsgId(cpf989 Msgf(QCPFMSG) MsgDta('Library size in mega bytes :' !> &Lib !> &MbSize_)
EndPgm
You can then call the program by
Call dsplibsize Mylib
And the program writes a message back to you with the size of the library
大家回答的都对。不过最方便的方法是:
DSPLIB LIB(DB_LIB) OUTPUT(*PRINT)
SPOOLFILE的下面系统都替你加好了。
Total size : XXXXXXXXXX
* * * * * E N D O F L I S T I N G * * * * *
SBMJOB CMD(DSPLIB LIB(YourLib) OUTPUT(*PRINT))
Then go to the bottom of the generated spool file.
Here you can get the list of all objects in that particular library as well as Total number of objects. No need to count manually.
dspobjd <lib>/*all objtype(*all) output(*outfile) outfile(qtemp/x)
strsql
select sum(odobsz) from qtemp/x
How do I determine the number of files in a library and the size of the library?
Use the following on your library of choice:
Code:
DSPOBJD OBJ(MYLIB/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(QTEMP/JUNK)You now have a file (qtemp/junk) of all objects in mylib. Use your favorite sql/qry program to sum ODOBSZ selecting the object type of interest.
没用过这个命令,看过帮助文档得知,该SIZE是不包括库内的其他对象的,也就是这个库本身的大小。
PS:楼主回来啦。