This post deals with setting up access to DB2 on MVS with two requirements:

1. Capture DB2 changes with the DB2 CDC agent and Attunity Stream.
2. Be able to make changes to DB2 in a global 2PC transaction with other datasources.

The issue in setting up such a configuration is that 2PC requires that RRSAF be used to attach to DB2 for the data access, while the IFI interface used by Attunity Stream to capture DB2 changes only works with CAF.

To solve this issue, do the following:

1. Make a copy of the hlq.USERLIB(ODBCINI). Suppose you save it as hlq.USERLIB(ORRSAF).
2. Change the ORRSAF to use RRSAF instead of the default CAF.
3. Create a new RACF profile for RRSAF use. Call it ATTRRSAF.
4. Copy the ATTSRVR to ATTRRSAF in the user proclib.
5. Change ATTRRSAF to point to ORRSAF (DSNAOCLI DD card).
6. Change the workspace used for 2PC data access to include startupScript='ATTRRSAF.XY'.

The above steps will ensure that the data access workspace will use RRSAF to attach to DB2, while CAF will be used in the standard workspace generated for the CDC agent to use.