The Resource Recovery Services attachment facility (RRSAF)
enables your program to communicate with Db2.
Invoke RRSAF as an alternative to invoking CAF or when using stored
procedures that run in a WLM-established address space. RRSAF has
more capabilities than CAF.
Before you begin
Before you invoke RRSAF, perform the following actions:
- Ensure that the RRSAF language interface load module, DSNRLI,
is available.
- Ensure that your application satisfies the requirements for programs
that access RRSAF.
- Ensure that your application satisfies the general environment
characteristics for connecting to Db2.
- Ensure that you are familiar with the following z/OS® concepts and facilities:
- The CALL macro and standard module linkage conventions
- Program addressing and residency options (AMODE and RMODE)
- Creating and controlling tasks; multitasking
- Functional recovery facilities such as ESTAE, ESTAI, and FRRs
- Synchronization techniques such as WAIT/POST
- z/OS RRS functions, such
as SRRCMIT and SRRBACK
About this task
Applications that use RRSAF can be written in assembler
language, C, COBOL, Fortran, and PL/I. When choosing a language to
code your application in, consider the following restrictions:
- If you use z/OS macros
(ATTACH, WAIT, POST, and so on), choose a programming language that
supports them.
- The RRSAF TRANSLATE function is not available in Fortran. To use
this function, code it in a routine that is written in another language,
and then call that routine from Fortran.
Procedure
To invoke RRSAF:
- Perform one of the following actions:
- Explicitly invoke RRSAF by including in your program CALL DSNRLI
statements with the appropriate options.
The first option is an
RRSAF connection function, which describes the action that you want
RRSAF to take. The effect of any function depends in part on what
functions the program has already performed.
To code RRSAF
functions in C, COBOL, Fortran, or PL/I, follow the individual language's
rules for making calls to assembler language routines. Specify the
return code and reason code parameters in the parameter list for each
RRSAF call.
Requirement: For C, C++,
and PL/I applications, you must also include in your program the compiler
directives that are listed in the following table, because DSNRLI
is an assembler language program.
Table 1. Compiler directives to include in C, C++, and PL/I
applications that contain CALL DSNRLI statements
| Language |
Compiler directive to include |
| C |
#pragma linkage(dsnrli, OS)
|
| C++ |
extern "OS" {
int DSNRLI(
char * functn,
...); }
|
| PL/I |
DCL DSNRLI ENTRY OPTIONS(ASM,INTER,RETCODE);
|
- Implicitly invoke RRSAF by including SQL statements or IFI calls
in your program just as you would in any program. The RRSAF facility
establishes the connection to Db2 with
the default values for the subsystem name, plan name and authorization
ID.
Restriction: If your program can make its first SQL
call from different modules with different DBRMs, you cannot use a
default plan name and thus, you cannot implicitly invoke RRSAF. Instead,
you must explicitly invoke RRSAF by calling the CREATE THREAD function.
Requirement: If your application includes
both SQL and IFI calls, you must issue at least one SQL call before
you issue any IFI calls. This action ensures that your application
uses the correct plan.
- If you implicitly invoked RRSAF, determine if the implicit
connection was successful by examining the return code and reason
code immediately after the first executable SQL statement within the
application program. Your program can check these codes by performing
one of the following actions:
- Examine registers 0 and 15 directly.
- Examine the SQLCA, and if the SQLCODE is -981, obtain the return
and reason code from the message text. The return code is the first
token, and the reason code is the second token.
If the implicit connection is successful, the application can
examine the SQLCODE for the first, and subsequent, SQL statements.
Example of an RRSAF configuration
The following figure shows an conceptual example of invoking and using RRSAF.