IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  Return the error code of RUN map

    Posted 06/15/10 05:16 AM

    Originally posted by: Kiran Kumar Reddy


    Hi,

    I am using the chain maps feature of WTX. I have a map, say map1 which executes the second map, say map2 using the run function.

    I am aborting the execution of map1 using the Valid() & Fail() functions if the execution of RUN map fails.

    = VALID ( RUN ("map2.mmc"), fail (lasterrorcode () ) )

    I am able to get the error code for failure of the RUN map, map2.mmc in the audit file of map1.mmc

    But the error code returned by map1 is always 30 - "Fail function aborted the map".

    Is there an option to return the error code of map2 in map1 and also abort the execution of map1?
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 2.  Re: Return the error code of RUN map

    Posted 06/15/10 07:55 AM

    Originally posted by: DianeC


    LASTERRORCODE( ) + LASTERRORMSG( ) usually get us those items in the audit log and we can see what the problem is.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 3.  Re: Return the error code of RUN map

    Posted 06/15/10 08:17 AM

    Originally posted by: Kiran Kumar Reddy


    Right, we can see them in the audit log.

    The issue is with the error code/message returned by the calling map, map1.

    It always returns "30-Fail function aborted the map" due to which the server is unable to give the exact error message for which the map actually failed.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 4.  Re: Return the error code of RUN map

    Posted 06/15/10 09:44 AM

    Originally posted by: Jan_Frederik_Sorge


    You will have to parse the audit log within a separate map to get the return code of the map you have called but you cannot change the return code of the "caller" map.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 5.  Re: Return the error code of RUN map

    Posted 06/15/10 10:26 AM

    Originally posted by: SystemAdmin


    The FAIL will allow you to create a more informative message that will be placed in the map audit log execution summary, message element (FAIL function aborted map:"here is the user message"). "here is the user message" will be whatever you put as the argument to the FAIL function. So as it has been stated, you could write a map to read the audit in and parse out the return code.

    Another option is to not use the VALID function with the RUN function and on a subsequent map rule evaluate the output object where the RUN was called. If it is != "0" then you can use the LASTERRORCODE and LASTERRORMSG to get the information regarding map2's execution. You can then get as elaborate as you want to use the relavent error information (send email, trigger another map to run...)
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 6.  Re: Return the error code of RUN map

    Posted 06/15/10 10:54 AM

    Originally posted by: Kiran Kumar Reddy


    Is there a way I can give the error code responsible for failure of the map instead of the error code for Fail.

    Basically I am looking for an option to overwrite the error code being retuned to the server with the error code that actually caused the failure in the RUN map/called map.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 7.  Re: Return the error code of RUN map

    Posted 06/15/10 11:27 AM

    Originally posted by: SystemAdmin


    No, as it has been stated, you cannot override the return code of any map execution.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 8.  Re: Return the error code of RUN map

    Posted 06/15/10 12:54 PM

    Originally posted by: DianeC


    This is our map rule:
    VALID (
    RUN ( "../movedata/movedata.mmc", path_of_output),
    FAIL ( "FTP of flat file failed : map =http://../movedata/movedata.mmc;
    AdptCmd = ;
    Run return code = " + LASTERRORCODE( ) + " (" + LASTERRORMSG( ) + ")" ) )

    And we would get this type of error message:
    <Message>FAIL function aborted map:FTP of flat file failed : map = http://../movedata/movedata.mmc;
    Run return code = 3 (Could not open map)</Message>
    So, I'm confused as to why you are not getting the exact (true) error in your log. We have always gotten the actual fail code & message.
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 9.  Re: Return the error code of RUN map

    Posted 06/15/10 04:02 PM

    Originally posted by: SystemAdmin


    You need to get the map2 to return the audit log back to the calling map, you can do this by amending your command line to:
    
    = RUN (
    "map2.mmc",
    "-AEM" )
    

    this will echo the audit log of map2 back to the rule that you called the map from.

    you can then pull out the error message from map2 using the following in another rule:
    
    =EITHER (WORD( WORD( RunMap Field:Results, 
    "</Message>", 1 ), 
    "<Message>", 2 ), LASTERRORMSG())
    


    You could also use:
    {code}SUBSTITUTE (RunMap Field:Results,"FAIL function aborted map:","" )
    to remove the auto generated failure message and just leave the original FAIL function text from running map2.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 10.  Re: Return the error code of RUN map

    Posted 06/16/10 05:37 AM

    Originally posted by: Kiran Kumar Reddy


    I am able to get the error mesage/code in the audit log.

    Since I am Failing map1 when map2 fails, I want the map2 error code to be returned by map1.

    The reason for that is, we have a primitive in WID for map1 which inturn executes map2. So, incase of failure the map1 always returns the error code for FAIL () function to the Integration server.

    The status file we create in the WID doesnt have the exact error code that caused the failure.
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 11.  Re: Return the error code of RUN map

    Posted 06/17/10 02:00 PM

    Originally posted by: SystemAdmin


    sounds like all you need to do is:
    
    =IF (check 
    
    if map2 failed, FAIL(EITHER (WORD( WORD( RunMap Field:Results, 
    "</Message>", 1 ), 
    "<Message>", 2 ), LASTERRORMSG()))
    


    that'll give the error for map2 in the audit log for map1.
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender