Topic
  • 2 replies
  • Latest Post - ‏2013-03-27T17:38:18Z by SystemAdmin
SystemAdmin
SystemAdmin
1192 Posts

Pinned topic Extract integer fails if extract region is empty

‏2013-03-22T13:04:56Z |
I have a macro variable named $varTRN$ and is set as integer data type. I created an Extract action and extract a value into $varTRN$, this value is then compared inside an Evaluate If action ($varTRN$ == $varPromptTRN$).
If the field I am extracting (single row, length 3) is empty (no data or ' ' if you prefer) the evaluate action completes correctly and I see a result but from that step onwards the macro is in "frozen" state, even after the designated timeout the macro still hangs. In Host Terminal preview window the macro never stops (Stop Macro button is lit).

Why does this happen? I tired checking in another Evaluate If action if $varTRN$ != null but it doesn't work, the result is same as above.

Thank you
Updated on 2013-03-27T17:38:18Z at 2013-03-27T17:38:18Z by SystemAdmin
  • tmparker
    tmparker
    518 Posts

    Re: Extract integer fails if extract region is empty

    ‏2013-03-26T04:31:36Z  
    The problem you are describing sounds like you are most likely hitting an error or exception in the macro when it's running. What you need to do is run the studio with the console showing so you can see the output and determine what the error is. I wrote another entry on this other thread describing how to show the studio console, https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14821005&#14821005. Once you have the console displayed, run your macro in the studio and then you will know what is failing.

    Thanks
    Tim
  • SystemAdmin
    SystemAdmin
    1192 Posts

    Re: Extract integer fails if extract region is empty

    ‏2013-03-27T17:38:18Z  
    • tmparker
    • ‏2013-03-26T04:31:36Z
    The problem you are describing sounds like you are most likely hitting an error or exception in the macro when it's running. What you need to do is run the studio with the console showing so you can see the output and determine what the error is. I wrote another entry on this other thread describing how to show the studio console, https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14821005&#14821005. Once you have the console displayed, run your macro in the studio and then you will know what is failing.

    Thanks
    Tim
    Thank you Tim, I was able to setup a console and log my test macro.
    This is the error:
    
    com.ibm.eNetwork.ECL.VariableException A type mismatch occurred 
    
    while updating variable $varTRN$
    

    I found a link with the error description Variables and imported Java classes (search for: 'A type mismatch occurred while updating variable $intLength$')

    I solved the issue by first extracting this region as a String, compare if this string is not empty and then extract into $varTRN$ (integer type), if the region is indeed empty then update $varTRN$ to 0. The only minor this is I am comparing $varTRNString$ != ' ' with three spaces. Are there any trim() method or similar available for variable formatting?