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 ( )
Returns:
A single text item

Although LASTERRORMSG has no arguments, it does require parentheses.

LASTERRORMSG 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
  • GET
  • DBQUERY
  • PUT
  • DDEQUERY
  • RUN
  • EXIT

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 following message is reported in the execution audit log:

    Failure on RUN (8): One or more inputs was invalid.

Related functions

  • DBLOOKUP
  • DBQUERY
  • DDEQUERY