Mapper main function

This is the main entry point for the mapper. This function initializes the mapper, the output document and some references before calling ProcessTransaction().


CREATE FUNCTION Main() RETURNS BOOLEAN
MAPPER: BEGIN
   -----------------------------
   -- Mapper Initialization Code
   -----------------------------
   IF NOT PSEUDO_CONST_INIT THEN
      CALL InitPseudoConstants();
   END IF;

   -- reference the input root
   MOVE rInputBody TO InputRoot.{INPUT_DOMAIN};

   CALL InitFirstTransactionReference();

   -- copy over the message headers
   CALL CopyMessageHeaders();

   -- create the output root
   CALL PhysicalTransmissionFlow.InitDocMapping(OutputRoot, rMapDoc);

   -- create the 'txn' element with type = 'TXN_PAYMENT' | 'TXN_SECURITIES' | 'TRANSACTION' | custom extension
   CALL PhysicalTransmissionFlow.InitTxnMapping(OutputRoot, rMapDoc, 'TXN_PAYMENT');

   -- create 'cols' and ISFMessage elements
   CALL PhysicalTransmissionFlow.InitTxnIsf(rMapDoc, rIsf, isf, 'isf', rCols);

   CALL ProcessTransaction();

   RETURN TRUE;
END MAPPER;