Data Transformation Engine Functions and Expressions Reference Guide

Chapter 3 - Function Reference LASTERRORMSG
Functions and Expressions Reference Guide
139
LASTERRORMSG
The LASTERRORMSG function returns a text item whose value is the message
corresponding to the last error code returned by one of a specified set of functions
during map execution.
Syntax
LASTERRORMSG ( )
Meaning
LASTERRORMSG ( )
Note Although LASTERRORMSG has no arguments, it does require parentheses.
Returns
This function returns a single-text-item.
Returns a text item whose value is the message corresponding to the last error
code returned by one of a specified set of functions during map execution.
The following is the list of functions that can fail:
DBLOOKUP DBQUERY DDEQUERY EXIT
GET PUT RUN
Examples
Message = VALID ( RUN ( "Map1Msg.mmc" , "-AE –OMMSMQ1B ‘-QN
.\aqueue -CID 2001’" ), FAIL ( "Failure on RUN (" + TEXT
(LASTERRORCODE ( ) ) + "):" + LASTERRORMSG ( ) ) )
In this example, the LASTERRORCODE and LASTERRORMSG functions are being
used in conjunction with the
FAIL and VALID functions to fail (abort) the map
if the map executed by the
RUN function (Map1Msg.mmc) fails. In this
example, the map fails and returns the error code and error message reported
by the
RUN function using the LASTERRORCODE and LASTERRORMSG functions.
If Map1Msg fails because one or more of its inputs was invalid, Message is
assigned a value of NONE. The map aborts and the message Failure on RUN