LASTERRORCODE

The LASTERRORCODE function returns a text item whose value is the last error code returned by one of a specified set of functions during map execution.

You can use LASTERRORCODE to interrogate or report the error code returned by one of the external interface functions.

Syntax:
LASTERRORCODE ( )
Meaning:
LASTERRORCODE ( )
Returns:
A single text item

LASTERRORCODE has no arguments but it requires parentheses.

LASTERRORCODE returns a text item whose value is the last error code returned by one of a specified set of functions during map execution.

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

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

Related functions

  • DBLOOKUP
  • DBQUERY
  • DDEQUERY

Feedback