Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Values from the RUN Map

Status
Not open for further replies.

vrs1008

Programmer
Sep 16, 2003
62
US
Hi,

I am calling Run map from the controller map.

Run map returns the status code to the controller map.
0-Success and non zero for failure.

Is there any way that I can get the error code and the error message from the run map.

if return code is 8 then it should also return One or more input was invalid
if return code is 30 then it should also return Fail function aborted map + user defined message.

I want to use Error code and Error message both coming out of RUN map for my reporting purpose.

Regards,
Vibhav1008
 
One of the things we do when running a map via command server is force log files on error overriding the log file names. The log files are prefixed with a common job number or file id. The non-wtx scheduler then checks the cntl map log file for errors and archives accordingly.

The cntl log tells you what map failed and the runmap log contains the specific failure code and message.

 
We extract the return code and error message from all our run maps, first call the RUN map with -AEM:
=RUN("mymap.mmc", "parameters"+" -AEM")
this will echo back the audit log.

then use something like:
=EITHER (WORD( WORD( audit_log, "mapreturn=""", 2 ), """",1 ), audit_log, LASTERRORCODE())
to pull back the return code from the audit log (or use the last error code)

the error message can be found with:
=EITHER (WORD( WORD( audit_log, "</Message>", 1 ), "<Message>", 2 ), LASTERRORMSG())

We also use a third rule to pull out extra information from the target adapter if needed and clean up the error message:
=IF (return_code !="0",
IF (return_code = "30", SUBSTITUTE (return_msg,"FAIL function aborted map:","" ),
IF (return_code = "9", /* check adapter return code */
WORD (WORD (WORD (audit_log, "<TargetReport", 2),"adapterreturn=""",2),""">",1)+" "+
WORD (WORD (WORD (audit_log, "<TargetReport", 2),"<Message>",2),"</Message>",1) +" "+
WORD (WORD (WORD (audit_log, "<TargetReport", 2),"<Settings>",2),"</Settings>",1),
return_code+" "+return_message )))

 
Thanks guys for the reply...It helped...

Regards,
Vibhav1008
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top