Previous Topic: External Action BlocksNext Topic: Modify External Action Block Sample Code


Use External Action Blocks

Follow these steps:

  1. Open your model using the CA Gen Toolset.
  2. Select Design, then Work Set List.
  3. Add a work set named DB2_MVS_OR_XDB_SQLCA. The CA Gen toolset and generators consider the XDB product equivalent to DB2 for z/OS. CA Gen includes the equivalent EAB for XDB on the platforms it supports.
  4. Add the following attributes to this work set, in this order:
    SQLCODE

    8 byte numeric

    MESSAGE_LENGTH

    8 byte numeric

    ERROR_MSG

    Mixed case text of varying length.

    Limits: 256 bytes

    SQLWARN

    11 bytes of text, fixed length

    SQLSTATE

    8 bytes of text, fixed length

    DBMS_TYPE

    8 bytes of case-sensitive text, fixed length

  5. Select Design, then Action Diagram.
  6. Create a action block that is named GET_DB2_MVS_OR_XDB_SQLCA with the default action block property settings, to ensure the High Performance View Passing, and Generate Missing Flags in Code options are enabled.
  7. Add an export view to this action block containing the DB2_MVS_OR_XDB_SQLCA work set, and its attributes, in the same order.
  8. Add EXTERNAL as the only statement in the action block. You also add notes.
  9. Open each existing action diagram that retrieve the SQLCA data.
  10. Add a USE GET_DB2_MVS_OR_XDB_SQLCA statement after the appropriate the WHEN DATABASE statements, and match a local or export view to the EAB's DB2_MVS_OR_XDB_SQLCA export view.

    The USE statement does not have to be subordinate to the WHEN DATABASE statement, but the EAB fails to work properly unless a WHEN DATABASE statement has actually executed first.

  11. Select Construction, then Packaging. Open a construction environment (Online, Batch, or Cooperative), that contains an action diagram that USES the new EAB.
  12. Expand a load module that USES the new EAB.
  13. Select GET_DB2_MVS_OR_XDB_SQLCA, Detail, Properties.
  14. Specify GETXDBSQ as the source member name.
  15. Save your model.
  16. You do not need to generate the External Action Block stub.
  17. Copy source member GETXDBSQ from your CA Gen CEHBSAMP to a separate library.
  18. Precompile, compile, and link edit GETXDBSQ. Use the compile and link options as defined in the chapter External Action Blocks.
  19. On the Host Encyclopedia, ensure the load library name that contains your load module is in your External Action Block Load Library or External System Load Library specification. For more information, see the chapter Target Environment and Construction Libraries.
  20. On the Host Encyclopedia, expand a load module that uses GET_DB2_MVS_OR_XDB_SQLCA. Find this EAB in the component list, type X next to it, and press Enter.
  21. In the first DBRM_NAME field, type GETXDBSQ, and press F6 to save your model.
  22. Regenerate and reinstall load modules that you modified to USE this EAB.

More information:

Specify Target Environment for HE