Call attachment facility

An attachment facility enables programs to communicate with DB2®. The call attachment facility (CAF) provides such a connection for programs that run in z/OS® batch, TSO foreground, and TSO background. The CAF needs tight control over the session environment.

A program that uses CAF can perform the following actions:
  • Access DB2 from z/OS address spaces where TSO, IMS™, or CICS® do not exist.
  • Access DB2 from multiple z/OS tasks in an address space.
  • Access the DB2 IFI.
  • Run when DB2 is down.
    Restriction: The application cannot run SQL when DB2 is down.
  • Run with or without the TSO terminal monitor program (TMP).
  • Run without being a subtask of the DSN command processor or of any DB2 code.
  • Run above or below the 16-MB line. (The CAF code resides below the line.)
  • Establish an explicit connection to DB2, through a CALL interface, with control over the exact state of the connection.
  • Establish an implicit connection to DB2, by using SQL statements or IFI calls without first calling CAF, with a default plan name and subsystem identifier.
  • Verify that the application is using the correct release of DB2.
  • Supply event control blocks (ECBs), for DB2 to post, that signal startup or termination.
  • Intercept return codes, reason codes, and abend codes from DB2 and translate them into messages.

Any task in an address space can establish a connection to DB2 through CAF. Only one connection can exist for each task control block (TCB). A DB2 service request that is issued by a program that is running under a given task is associated with that task's connection to DB2. The service request operates independently of any DB2 activity under any other task.

Each connected task can run a plan. Multiple tasks in a single address space can specify the same plan, but each instance of a plan runs independently from the others. A task can terminate its plan and run a different plan without fully breaking its connection to DB2.

CAF does not generate task structures.

When you design your application, consider that using multiple simultaneous connections can increase the possibility of deadlocks and DB2 resource contention.

A tracing facility provides diagnostic messages that aid in debugging programs and diagnosing errors in the CAF code. In particular, attempts to use CAF incorrectly cause error messages in the trace stream.

Restriction: CAF does not provide attention processing exits or functional recovery routines. You can provide whatever attention handling and functional recovery your application needs, but you must use ESTAE/ESTAI type recovery routines and not Enabled Unlocked Task (EUT) FRR routines.