Display and understand your Library List

The library list on the AS/400 is similar to the "path" on PC's. Mainframe programmers may compare it to the "steplib" or "joblib". It defines the order of libraries that the operating system uses to find objects.

When you execute a command or call a program, the AS/400 must know where to find the command or program. Sometimes, you specify the library explicitly. But if you don't, the AS/400 will find your command or program but looking in each library in your library list. It will use the first one that it finds.

This is very handy for testing. If you are testing a version of a program, you can put it in a test library which is at the top of your library list. Then, whenever you specify a program or refer to a file, the system will use any object it can find in the test library. If it can't find it there, it will look further through your library list until it finds it.

So, setting up a test environment is as simple as:
1) Create a test library.
2) Put objects that you want to test in the library. These can be files, menus, programs or any AS/400 object.
3) Insert the test library name in your library list before your production libraries.

Now you can execute test programs and modify test data. The best part is that you don't need to copy production programs or files into the test library unless they will be affected by the test. That is, all those supporting database files that you need to run a program, but that are used for input only, do not need to be copied to the test library. Of course, if you are unsure if a file will be modified during your test procedure, copy it to the test library anyway.

Once you have inserted the test library name in your library list, you will want to make sure everything is in the proper order. Use the DSPLIBL command to see your library list. You will probably see three types of list entries:

1) The SYS libraries have operating system objects. This is where the AS/400 commands and menus live.
2) The CUR library is your current library. This is your first user library and is where objects are created if you don't specify which library to      use.
3) The USR libraries list your other user libraries.

Use EDTLIBL to change your USR libraries. You can rearrange the list, remove libraries or add libraries. Notice that you can't see the SYS or CUR libraries when you use EDTLIBL. The only way to change the current library is with the CHGCURLIB command.

The WRKOBJ command will help see which object is being used. This command is similar to the directory ("dir") command on PC's. Use it to list objects in your library list.

So, if you have three copies of a program, "PAYCALC", in different libraries, use the command WRKOBJ PAYCALC to see which copy of "PAYCALC" will be used. The command will list all objects named "PAYCALC" in the sequence that the AS/400 finds them. If you ever say to yourself in frustration, "I know I changed the program but it looks like I'm still running the original program", it's a pretty good bet that you're executing a different copy of the program than you think. This is only a fraction of the power of the WRKOBJ command. It is the easiest way to navigate through an undocumented system.

DSPLIBL - Display complete library list

EDTLIBL - Edit library list

CHGCURLIB - Change Current Library

WRKOBJ - Work with objects (similar to PC "dir")

 

Back to Basic 400 Skills   |   Main Page