Mapping procedures and functions

This section of the template is where you are expected to add or edit the mapping code. The following main references are used when the mapping code is called:
rInputTxn
This is a reference to the output ISFMessage element. You are expected to initialize rInputTxn in the call to InitFirstTransactionReference().
rIsf
This is a reference to the ISFMessage element of an ISF instance tree.
rMapDoc
This is a reference to the root of the EndMapper (v2) document that holds all of the persistence content for EndMapper, including ISF.
rCols
This is a reference to the 'cols' element under rMapDoc.

InitFirstTransactionReference

This procedure locates the rInputTxn reference to the transaction for mapping.

CREATE PROCEDURE InitFirstTransactionReference()
BEGIN
   -- TODO rInputBody.TXN this to refer to the repeating 'transaction' level input field
   MOVE rInputTxn TO rInputBody.TXN[1];
END;

MapTransactionHeader

This procedure maps the transaction header, if appropriate. Examples of mapping statements are supplied in the body of the procedure. You are responsible for implementing the code in this procedure.

CREATE PROCEDURE MapTransactionHeader()
BEGIN
   -- Set the ISF BusinessConcept
   -- This can be a simple hardcoded choice for the mapper 
   -- or it could be a function of the input message or input channel
   -- For this example it is a PaymentOrigination
   SET rIsf.Header.BusinessConcept = 'PaymentOrigination';

   -- If this is an uninitiated request, we will have no MasterTransactionId
   SET rIsf.Header.MasterTransactionId = -1;

   -- We may want to map an Input field to the RequestID
   SET rIsf.Header.RequestID = -1;

   -- TransactionId will be set by the FTM Core EndMapper
   SET rIsf.Header.TransactionId = NULL;
END;

MapTransaction

This procedure maps the transaction. A short and incomplete mapping example is supplied in the body of the procedure. The sample demonstrates the creation of the ISFTransaction (in this case PaymentOrigination), the mapping of one field, and calling a procedure to map creditor information. You are responsible for implementing the code in this procedure.

CREATE PROCEDURE MapTransaction()
BEGIN
   -- Create the ISF Transaction element
   -- This example uses the abstract element 'Transaction'
   CREATE LASTCHILD OF rIsf AS rIsfTxn NAMESPACE isf NAME 'Transaction';

   -- Note 1 - order of field creation is important for a valid document
   -- Note 2 - ensure mandatory fields are mapped for a valid document
   -- example...
   SET rIsfTxn.AnElement1 = <value>;
   SET rIsfTxn.AnElement2 = <value>;
   CALL MapSomeFields();
   -- etc...END;

SetDatabaseRecordValues_Txn

This procedure creates, in the End Mapper (v2) document tree, a set of records that is expected by FTM core when FTM core finalizes the mapping and inserts the transaction data into the database. You must update this code to correctly populate the database records because they are visible on the FTM Operations and Administration console.

CREATE PROCEDURE SetDatabaseRecordValues_Txn()
BEGIN
   -- assign col data as per the EndMapper2 XSD
   -- option to use utility functions as shown for convenience

   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'CID', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'UID', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'SUBTYPE', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'OBJ_CLASS', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'ALT_ID', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'BANK_CODE', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'ACCOUNT', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'DEST_BANK_CODE', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'DEST_ACCOUNT', <char value>);
   CALL PhysicalTransmissionFlow.NewDecimalCol(rCols, 'AMOUNT', <decimal value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'CURRENCY', <char value>);
   CALL PhysicalTransmissionFlow.NewDecimalCol(rCols, 'FX_RATE', <decimal value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'DEBIT_CREDIT_FLAG', <char value>);
   CALL PhysicalTransmissionFlow.NewDateTimeCol(rCols, 'TXN_TIMESTAMP', <time stamp value>);
   CALL PhysicalTransmissionFlow.NewDateCol(rCols, 'BOOK_DATE', <date value>);
   CALL PhysicalTransmissionFlow.NewDateCol(rCols, 'VALUE_DATE', <date value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'SETTLEMENT_SYSTEM', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'USER', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'USER_COMMENT', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'TXN_DATA1', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'TXN_DATA2', <char value>);

END;

MapTransactionHeader

This procedure maps the transaction header, if appropriate. Examples of mapping statements are supplied in the body of the procedure. You are responsible for implementing the code in this procedure.

CREATE PROCEDURE MapTransactionHeader()
BEGIN
   -- Set the ISF BusinessConcept
   -- This can be a simple hardcoded choice for the mapper 
   -- or it could be a function of the input message or input channel
   -- For this example it is a PaymentOrigination
   SET rIsf.Header.BusinessConcept = 'PaymentOrigination';

   -- If this is an uninitiated request we will have no MasterTransactionId
   SET rIsf.Header.MasterTransactionId = -1;

   -- We may want to map an Input field to the RequestID
   SET rIsf.Header.RequestID = -1;

   -- TransactionId will be set by the FTM Core EndMapper
   SET rIsf.Header.TransactionId = NULL;
END;

SetDatabaseRecordValues_PT

This procedure creates, in the EndMapper (v2) document tree, a set of records that is expected by FTM core when FTM core finalizes the mapping and inserts the physical transmission data into the database. You must update this code to correctly populate the database records because they are visible on the FTM Operations and Administration console.

CREATE PROCEDURE SetDatabaseRecordValues_PT()
BEGIN
   -- Note: updating the PT data from the Mapper carries a performance overhead

   -- create
   CALL PhysicalTransmissionFlow.Transmission(rMapDoc, rCols, 'TRANSMISSION');

   -- assign col data as per the EndMapper2 XSD
   -- option to use utility functions as shown for convenience
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'CID', <char value>);
   CALL PhysicalTransmissionFlow.NewStrCol(rCols, 'UID', <char value>);
END;

MapSomeFields

This procedure is provided only to demonstrate how to call a mapping function from MapTransaction. You are responsible for implementing the code in this and any further procedures that are required.

CREATE PROCEDURE MapSomeFields()
BEGIN
   DECLARE rElem REFERENCE TO rIsfTxn;
   CREATE LASTCHILD OF rIsfTxn AS rElem NAMESPACE isf NAME 'MyElement';

   SET rElem.AnElement = <value>;
END;