I would just use a simple TRXID proc to break down the message, and pull the element that you want, then set your routes appropriately. So MSGA value = foo then trxid = foosysa
MSGB value = bar then trxid = barsysb
Just remember that the value you set to the return of trxId is case sensitive, so make sure your return and the value in the route detail for the xlate/destination you want are the same.