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


Using External Action Blocks

To use these EABs in your application, follow this procedure:

  1. Open your model using CA Gen Toolset.
  2. Select Design, Work Set List.
  3. For the DBMS you are using, add a new work set named xxx_SQLCA, where "xxx" identifies the DBMS (Oracle, for example).
  4. Add the following attributes to this work set, in the order shown in the table:

Work Set (one per DBMS)

Attribute Name

Length

Domain

DB2_UDB_SQLCA

SQLCODE

8

Numeric

 

MESSAGE_LENGTH

8

Numeric

 

ERROR_MSG

256

Text, mixed case, varying length

 

SQLWARN

11

Text, uppercase, fixed length

 

SQLSTATE

5

Text, uppercase, fixed length

 

DBMS_TYPE

8

Text, mixed case, fixed length

MSSQL_SQLCA

SQLCODE

8

Numeric

 

MESSAGE_LENGTH

8

Numeric

 

ERROR_MSG

70

Text, mixed case, fixed length

 

SQLWARN

8

Text, uppercase, fixed length

 

SQLSTATE

5

Text, uppercase, fixed length

 

DBMS_TYPE

8

Text, mixed case, fixed length

 

DBMS_TYPE

8

Text, mixed case, fixed length

ORACLE_SQLCA

SQLCODE

8

Numeric

 

MESSAGE_LENGTH

8

Numeric

 

ERROR_MSG

70

Text, mixed case, fixed length

 

SQLWARN

8

Text, uppercase, fixed length

 

DBMS_TYPE

8

Text, mixed case, fixed length

ODBC_SQLCA

SQLSTATE

5

Text, uppercase, fixed length

 

SQLCODE

8

Numeric

 

ERROR_MSG

512

Text, mixed case, fixed length

 

MESSAGE_LENGTH

8

Numeric

 

DBMS_TYPE

8

Text, mixed case, fixed length

JDBC_SQLCA

SQLSTATE

5

Text, uppercase, fixed length

 

SQLCODE

8

Numeric

 

ERROR_MSG

512

Text, mixed case, fixed length

 

MESSAGE_LENGTH

8

Numeric

 

DBMS_TYPE

8

Text, mixed case, fixed length

ADONET_SQLCA

SQLSTATE

5

Text, uppercase, fixed length

 

SQLCODE

8

Numeric

 

ERROR_MSG

512

Text, mixed case, fixed length

 

MESSAGE_LENGTH

8

Numeric

 

DBMS_TYPE

8

Text, mixed case, fixed length

  1. Select Design, Action Diagram.
  2. Create a new action block named GET_xxx_SQLCA with the default action block property settings, such that both the High Performance View Passing and Generate Missing Flags in Code options are enabled.
  3. Add an export view to this action block containing the xxx_SQLCA work set, and all its attributes.

    Note: These must be in the order shown in the preceding table.

  4. Add EXTERNAL as the only statement in the action block (other than any notes you want to add).
  5. Open each existing action diagram that needs to retrieve the SQLCA data.
  6. Add a USE GET_xxx_SQLCA statement after the appropriate WHEN DATABASE statements and match a local or export view to the EAB's xxx_SQLCA export view.

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

  7. Select Construction, Packaging. Open a construction environment (Online, Batch, or Cooperative) that contains an action diagram that USES the new EAB.
  8. Expand a load module that USES the new EAB.
  9. Select GET_xxx_SQLCA, Detail, Properties.
  10. Specify the GETyyyyy source member name that corresponds to your DBMS:
  11. Save your model.

    You do not need to generate the external action block stub.

  12. Copy source member GETyyyyy from the SQLCA samples under the samples directory beneath your CA Gen directory to the EXTRN directory that you use for other external action blocks.
  13. Compile the source member and link it into the appropriate EXTRN.LIB for your application.

    The EAB source provided by CA Gen does not require precompilation or binding for workstation targets.

    Note: For more information about EAB, see the chapter “Using External Action Blocks.”

  14. Regenerate and reinstall any load modules that you modified to USE this EAB.