User Libraries


Aside from system libraries, the i5 can have any number of libraries you create. These libraries are referred to as user libraries.

Working with Libraries

The Work with Libraries (WRKLIB) command gives you a list of libraries. In the LIB parameter, you can specify what library or libraries you want to work with. For example, you could work with all user libraries on the system by executing:

       WRKLIB LIB(*ALLUSR) 

When you specify *ALLUSR, WRKLIB filters out IBM-supplied libraries.

You may use a generic name. For example, you could work with all libraries that have names beginning in Q by executing:

       WRKLIB LIB(Q*) 

If you have PDM, the Programming Development Manager, installed on your system, you can also use the Work with Libraries using PDM (WRKLIBPDM) command, which provides a few additional features not available in WRKLIB.

Creating Libraries

Creating a library is easy. You run the CRTLIB command and specify a few parameters. The LIB parameter, in particular, accepts the name you want to give the library.

Tip 

Do not choose a name that begins with the letter Q because this letter is reserved for IBM libraries.

Here are some examples:

        CRTLIB LIB(MYLIB) TEXT('My library') 

This command creates a library called MYLIB and gives it a text description of "My library."

        CRTLIB LIB(SCRATCH) TYPE(*TEST) TEXT('Scratch work        library') 

This command creates a library called SCRATCH with a text description. The TYPE parameter is *TEST, which indicates that this library contains only test objects. A test library (*TEST) does not protect its database files during debugging sessions, even if the programmer runs the Start Debug (STRDBG) command with UPDPROD(*NO), which normally would protect database files from updates.

Production libraries (*PROD), on the other hand, are protected from updates during debugging sessions if the programmer specifies UPDPROD(*NO) in the STRDBG command.

When you create a library, the system assumes TYPE(*PROD) by default.

        CRTLIB LIB(PROJECT) AUT(*USE) 

This command creates a library called PROJECT, and gives the library a public authority of *USE. This public authority means that all users, unless otherwise authorized, can use the library.

        CRTLIB LIB(PROJECT) AUT(*USE) CRTAUT(*EXCLUDE) 

The effect of this command is similar to that of the previous example. The only difference is that all objects created within library PROJECT will have a public authority of *EXCLUDE (by default). For example, if a user creates a data area in PROJECT and does not specify a public authority for it, the data area adopts the *EXCLUDE public authority specified in the library's CRTAUT parameter.

Displaying Libraries

At some time after creating a library, you may be curious about what objects are contained in it. You can quickly determine that using the Display Library (DSPLIB) command.

The DSPLIB command presents a list of objects and gives the size of each object. If you send this list to the screen, that information is all you get. If you send the list to the printer, however, the listing also contains the total of all the object sizes. Be aware that this is not the size of the library, but only the total size of the objects contained in it. You still have to add the size of the library object itself to this number.

Here is an example of the DSPLIB command:

        DSPLIB LIB(ARLIB) OUTPUT(*PRINT) 



IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 245

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net