Mapping procedures and functions

This section of the template is where you are expected to add or edit mapping code. The following references should be set up before the mapping code is called:
rIsf
This is a reference to the ISFMessage element of an ISF instance tree.
rOutputTxn
This is a reference to the integration node OutputBody. For example, OutputRoot.MRM or OutputRoot.XMLNSC.

MapBatchHeader

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

CREATE PROCEDURE MapBatchHeader()
BEGIN
   SET rOutputBat.BatchHeader.CustomerAssignedIdentifier = 'abc123';
   SET rOutputBat.BatchHeader.TotalTransactionAmount = rInputBat.VALUE_AMOUNT;
   SET rOutputBat.BatchHeader.TotalTransactionCount = nBatTxnCount;
   -- you can extend the header using the wildcard element
END;

MapTransactionHeader

This procedure maps the transaction header, if appropriate. The procedure body contains an example of a mapping statement. You are responsible for implementing the code in this procedure.

CREATE PROCEDURE MapTransactionHeader()
BEGIN
   -- TODO chanage as per your output format
   CREATE LASTCHILD OF rOutputBat AS rOutputTxn NAME 'Txn'; 

   -- Then map any header fields
   SET rOutputTxn.Header.Field1 = rIsf.Header.TransactionId;
   -- ...
END;

MapTransaction

This procedure maps the transaction. The procedure body contains a short and incomplete mapping sample. The sample assumes that the ISFTransaction is a PaymentOrigination, and demonstrates 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
   -- Initialize rIsfTxn
   -- TODO change if not using PaymentOrigination
   MOVE rIsfTxn TO rIsf.{isf}:PaymentOrigination; 

   -- now create the Output Transaction under rOutputBody
   -- for example
   SET rOutputTxn.Field1 = rIsfTxn.CreationDate;
   CALL MapCreditor();
   -- ...
END;

MapCreditor

This procedure maps the creditor details. It is provided 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 MapCreditor()
BEGIN
   DECLARE rIsfCreditor REFERENCE TO rIsfTxn.Creditor;
   SET rOutputTxn.Field2.ClientIdentification = rIsfCreditor.ClientIdentification;
   -- ...
END;