Displaying total number of libraries

635 pts.
Tags:
AS/400
AS/400 commands
AS/400 Library
hi, I want to display total number of libraries in my AS/400 srerver, Can any one tell me what would be the command for that. Thanks, Siddharth

Answer Wiki

Thanks. We'll let you know when a new response is added.

Two values control your library list when you first sign on. Programs called after sign-on can modify that list, though. The system part of the library list (QSYSLIBL) and the user part of the library list (QUSRLIBL) values set the user’s library list immediately after sign-on.

Use caution when setting these values. You cannot delete a library when it’s in use, and you cannot delete any library in a user’s initial list unless a change is made in the list or the user signs off.

QSYSLIBL can have up to 15 libraries, and QUSRLIBL can have up to 25.

– – – – – – – – – – – –

The answer to your question, however, is that a system maintained file QADBXREF, exists in QSYS and contains a (cross reference) list of objects in the QSYS file system. A ‘Library’ is an object type within QSYS, which is used as a container for other object types.

With QSECOFR authority, you may access this file and select from it those records which denote libraries, and count how many there are.

Alternatively, and sufficient for most purposes, there is the WRKLIB command, which will enable all libraries to be listed on screen

Alternatively, the DSPOBJD (Display Object Description) command can be used to generate a file containing the details of all libraries, which can be accessed with SQL, Query, or any other report tool, and the records counted.

You may care to note libraries named ‘Qxxx’ are denoted as system libraries, and many commands exclude them by default, but may include them if so desired.

Yorkshireman

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Sangay
    Hi, Thanks a lot for the response. I believe i was not quite clear to my question. I want the total number odf user libraries present in AS/400 server. Thanks in advance Siddharth
    635 pointsBadges:
    report
  • Security1
    Siddharth You can use the command WRKLIB *ALL which will dsiplay all libaries on your I5/OS or if you need to list every library along with a list of object that reside in library, you can use the SBMJOB command and run the command DSPLIB LIB(*ALL) OUTPUT(*PRINT). Hopes this Helps.
    770 pointsBadges:
    report
  • Sofar
    If you specifically only want user libraries, STRPDM option 1, and then in library specify *ALLUSR. This will give you the list of user libraries.
    120 pointsBadges:
    report
  • Sofar
    I just thought of a better solution: DSPOBJD OBJ(*ALLUSR) OBJTYPE(*LIB) OUTPUT(*OUTFILE) OUTFILE(QTEMP/USRLIBS) Send it to an outfile of your naming, I sent it to QTEMP/USRLIBS where I can then query it to get the number of user libraries.
    120 pointsBadges:
    report
  • OldSysAdmin
    Or submit a job with RTVDSKINF to run when the system is idle, then PRTDSKINF and you'll get a complete listing of the libraries plus their size plus some other good info.
    945 pointsBadges:
    report
  • Bsd167
    To count the total number of libraries in your as/400 follow SOFAR comments but instead of *ALLUSER value use *ALL, use the as/400 Query to count the total number of Test and Production libraries by counting the field `ODOBAT Object attribute` DSPOBJD OBJ(*ALL) OBJTYPE(*LIB) OUTPUT(*OUTFILE) OUTFILE(QTEMP/USRLIBS) .
    65 pointsBadges:
    report
  • DanTheDane
    If you have proper authority and access to SQL, try these SQL-statements SELECT count(distinct dbxlib) FROM qsys/qadbxref (total no of libs on sytem) SELECT * FROM qsys/qadbxref WHERE DBXOWN not like 'Q%' (list 'non-IBM' libs ..) SELECT count(distinct dbxlib) FROM qsys/qadbxref WHERE DBXOWN not like 'Q%' (no of 'non-IBM' libs...)
    2,555 pointsBadges:
    report
  • Gilly400
    Hi, I believe the solution from DanThe Dane will only give you a list of user libraries which contain database files. If you have libraries which are empty or only contain programs they will not be included. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • Sofar
    My answer to Siddharth was predicated on his statement that he wanted the total # of USER libraries; thus the requirement of *ALLUSR.
    120 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following