Transport map macros
A transport map can also contain macros. A macro is a pre-defined variable that does not exist in a device; however, the runtime environment has knowledge of its existence. The following macros are available when defining a payload from the Transport Map window:
$TRANSPORT_MAP_NAME
The $TRANSPORT_MAP_NAME macro is used to place the name of the transaction in the runtime payload. For ASCII payloads, the name of the transport map is added to the outbound message.
For XML payloads the name of the transport map is placed
within an <Item> tag. For database Insert, Batch
Insert, Update, Select, Select with Update, and Stored
Procedure operations, the transport map name is provided as
input to the database operation when the transaction is
executed.
$TRANSPORT_MAP_TS
The $TRANSPORT_MAP_TS macro is used to place the current timestamp when the transaction payload was written to the enterprise destination as part of processing a transaction. $TRANSPORT_MAP_TS is a valuable macro for automatically logging events in order to provide an audit trail that can be used to diagnose problems. You can add the $TRANSPORT_MAP_TS macro to a transport map so that current time and date are recorded as part of the output format. For example, for ASCII payloads the timestamp is added to the outbound message. You can select the timestamp format from a list.
An example output for the Month Day, YYYY HH:MM:SS AM/PM TZ
format is June 3, 2007 10:50:51 AM EDT.
When the Month Day, YYYY
HH:MM:SS AM/PM TZ format is
used in combination with a transport,
ASCII as the output format, and a comma
delimiter, the Transaction Server
encloses the output timestamp with
double-quotations, for example: "June 8, 2008 10:50:51 AM EDT" |
$GENERATED
SQL databases have the ability to automatically generate values for some columns. This is useful in situations that require the database engine to:
- Generate a unique identifier for a row whose value will be stored in this column (for example, an SQLServer TIMESTAMP column).
- Generate a numerically increasing or decreasing value (for example, the DB2 IDENTITY column usually specified in the CREATE TABLE clause as GENERATED ALWAYS AS IDENTITY).
- Optionally allow the database to use the next SEQUENCE value as the column value (for example, an Oracle SEQUENCE and corresponding database Insert operation).
For these situations, you must not map a value to the database column; instead, map the $GENERATED macro to the table column. The $GENERATED macro is used in conjunction with Insert and Batch Insert operations.
You can access the value of the column that is automatically generated by the database when the row is inserted. It is available as an output parameter called resultKey in the output tab of the Insert Enterprise Transaction action in the trigger. The value is returned only when accessing DB2, SQLServer, Oracle and mySQL.
$CONSTANT
The $CONSTANT macro adds a value that does not change. Constants can be numbers or non-numeric characters such as:
- A string (Hello)
- An integer (12345)
- A real: 2.34567 (the value always has a decimal point)
You can add a constant value to all transport maps. The following shows a $CONSTANT macro that was added to a transport map that is using a TCP transport and ASCII format as the payload output.
When the $CONSTANT macro is selected from the list, the
Field column becomes available as a box
you can type in.
$NULL
This macro is available on transport maps that are defined for a database transport. It is used to specify that a NULL value gets assigned to a column or stored procedure parameter when the map executes.
The $NULL macro can be used for the Insert, Batch Insert, Update, Select with Update and Stored Procedure SQL operations.
If you want to specify a NULL value from a trigger refer to the $NULL macro section of the Trigger macros page.