IBM i e-Book
A Developer’s Guide to Mastering IBM i Concepts
IBM i Index
Integrated Language Environment
Binding Directory
Introduction
The concept of the Binding Directory is crucial to understand while working with ILE programs. Binding Directory in IBM i is an object of type *BNDDIR.
It contains the entries of modules and service programs to be used in an ILE program. So, if we specify a binding directory in an ILE program, it can utilize the procedures present in modules & service programs bound.
Usage
Binding Directory is an important ILE concept & using it in the ILE program provides more efficiency by binding all the required procedures present in multiple modules and service programs in a single binding directory. There are multiple commands available to handle binding directories in IBM i, which then can be used in multiple ILE programs. Thus, reducing the need to write similar code again & again in different programs.
Useful Commands
The following commands are important to understand the concept of binding directory:
CRTBNDDIR (Create binding directory):
This command creates a binding directory object in the particular library. The command syntax can be expressed as:
CRTBNDDIR BNDDIR(*CURLIB/PIOBNDDIR) AUT(*ALL) TEXT('Test Binding Directory')
The noticeable parameters of this command are:
- BNDDIR: In this parameter, we have to specify the name of the library & binding directory object to be created. If we specify *CURLIB, the binding directory will be created in the current library.
- AUT: In this parameter, we have to specify the authority available to the users of the binding directory being created.
- TEXT:In this parameter, we can specify any text description for the *BNDDIR object being created.
If the user will do F4 on the CRTBNDDIR command, the below-mentioned prompt will be available:
ADDBNDDIRE (Add entry to binding directory):
This command adds entries of either modules or service programs to an existing binding directory. The command syntax can be expressed as:
ADDBNDDIRE BNDDIR(PIOLIB/PIOBNDDIR) OBJ((PIOLIB/PIOMOD1 *MODULE) (PIOLIB/PIOSRVPGM1 *SRVPGM *IMMED)) POSITION(*LAST)
The noticeable parameters of this command are:
- BNDDIR: In this parameter, we have to specify the name of the library & binding directory to which we are adding the entry.
- If we specify *CURLIB, the binding directory from the current library is picked.
- If we specify *LIBL, the binding directory will be picked from the library mentioned first in the library list.
- OBJ: In this parameter, we mention the details of all object entries (either *MODULE or *SRVPGM) we want to add in the binding directory.
- POSITION: In this parameter, we mention the level at which the object entry will be located in the BNDDIR.
If the user will do F4 on the ADDBNDDIRE command, the below-mentioned prompt will be available:
DSPBNDDIR (Display Binding Directory):
This command is utilized to display the details of the objects bound in an existing binding directory. The command syntax can be expressed as:
DSPBNDDIR BNDDIR(PIOLIB/PIOBNDDIR) OUTPUT(*)
The noticeable parameters of this command are:
BNDDIR: In this parameter, we have to specify the name of the library and binding directory that we want to be displayed.
OUTPUT: In this parameter, if we will mention *PRINT value then output from the command will be printed to the job’s spooled output. If *OUTFILE is mentioned then we can store the output of the command in the database file mentioned.
If the user will do F4 on the DSPBNDDIR command, the below-mentioned prompt will be available:
If we run this command for the binding directory PIOBNDDIR, the following result will be visible:
WRKBNDDIR (Work with Binding Directory):
Through this command, we can do multiple operations with a binding directory like create, delete, and display. Also, we can do operations with the entries of the binding directory like add an entry and remove an entry. The command syntax can be expressed as:
WRKBNDDIR BNDDIR(PIOLIB/PIOBNDDIR)
The noticeable parameter of this command is:
- BNDDIR: In this parameter, we have to specify the name of the library and binding directory that we want to work with.
If the user will do F4 on the WRKBNDDIR command, the below-mentioned prompt will be available:
If we run this command for the binding directory PIOBNDDIR, the following result will be visible:
DLTBNDDIR (Delete Binding directory)
This command is used to delete an existing binding directory object from a particular library. The command syntax can be expressed as:
DLTBNDDIR BNDDIR(PIOLIB/PIOBNDDIR)
The noticeable parameter of this command is:
- BNDDIR: In this parameter, we have to specify the library name and binding directory we want to delete.
If the user will do F4 on the DLTBNDDIR command, the below-mentioned prompt will be available:
Restrictions
The restrictions a user can have on a binding directory depend on the authority level provided while executing CRTBNDDIR command.
- *LIBCRTAUT: If we specify this AUT value, the binding directory will be created with the authority level same as specified in the CRTAUT parameter while creating the library (using the CRTLIB command) in which the BNDDIR object is being created now.
- *CHANGE: If we specify this AUT value, the user can do all basic operations & also be able to change the BNDDIR.
- *ALL: If we specify this AUT value, the user can do all the operations.
- *USE: If we specify this AUT value, the user can do all basic operations but cannot change the BNDDIR.