Attachments There are five different attachment facilities that can be used depending on the environment where the program will execute. Only one attachment can be active within a program at any given time. The attachments are
Each program runs in an address space called the allied address space. The DB2 attachment facility modules are called by the program, execute within the allied address space, and establish communication with the DB2 address spaces. When initialized the attachment modules make the link to DB2 and agent control blocks are created in the DSNMSTR address space to control the program's DB2 processing. When a program issues a SQL statement, the attachment modules are given control. The attachment programs prepare the request for DB2 and pass it over to the DB2 address space. Results are passed back to the attachment programs and any results are copied into the application storage areas. Execution EnvironmentsThere are several environments in which an application program can execute. The attachment that can be used by a particular program depends on the environment that the program runs in. Table 14-1 shows the attachment facilities that are available for each multiple virtual system (MVS) environment. Table 14-1. Attachment Facilities for MVS Environments
As you can see, some environments, like TSO, allow for a variety of available attachments, where CICS supports only a single attachment. Knowing where your program will execute is important in organizing a project that consists of several modules, as only one type of attachment can be active at a time. Program PreparationPrograms using embedded SQL must be precompiled to translate the EXEC SQL statements into code that the language compilers understand. When a program is processed , the precompiler replaces SQL statements with appropriate conditioning source code and a call to the DB2 high-level interface modules, usually DSNHLI or DSNHLI2. Each attachment has a load module that supplies these entry points. This load module must be linked into the application's load module or loaded dynamically at execution time by the application. The attachment interface load modules are listed in Table 14-2. Table 14-2. Attachment Interface Load Modules
Fortran uses module DSNHFT instead of DSNELI for the TSO attachment. The CICS interface module, DSNCLI, is supplied in the CICS product libraries. SecurityDB2 and RACF provide the capability to control which attachments are available to a given user. The RACF DSNR resource class protects the attachments. When a program attaches to DB2 and transfers control to the DB2 address space, DB2 checks with RACF to verify that the user executing the program is authorized to use the attachment type. For some attachments, the programmer can control access to a program's package or plan by specifying the ENABLE or DISABLE options on the BIND command. With some of the ENABLE or DISABLE options, a specific connection name can also be listed. |
Team-Fly |
Top |