Automic Workload Automation

  • 1.  Return value of PREP_PROCESS_FILENAME

    Posted Feb 08, 2018 03:23 AM
    Your question was:
    The documentation lists the return codes of the script function PREP_PROCESS_FILENAME:

    vd6cbrwyfboo.pnghttps://us.v-cdn.net/5019921/uploads/editor/js/vd6cbrwyfboo.png" width="557">

    But how to retrieve them?

    Our answer:
    Use the script function SYS_LAST_ERR_NR. You can use it like this:

    :SET &HND# = PREP_PROCESS_FILENAME("VWGSUP15_WS112_X64_01_SYS","c:\uc4\xyz\*","Y",,,,"UC_LOGIN=LOGIN.JAC")
    :SET &ERRNR# = SYS_LAST_ERR_NR()
    :IF &ERRNR# NE "0"
    :   SET &ERRINS#  = SYS_LAST_ERR_INS()
    :   SET &MESSAGE# = GET_MSG_TXT (&ERRNR#,&ERRINS#)
    :   SEND_MSG , , &MESSAGE#
    :ENDIF

    You will get a message like above in the Message Window:

    08.02.2018 09:20:55 -  U00020000 Message from 'JAC/SUP': 'U00011436 Error while sampling files. Filter: 'c:\uc4\xyz\*', error code: '3', error description: 'The system cannot find the path specified.'.'


  • 2.  Return value of PREP_PROCESS_FILENAME

    Posted Feb 08, 2018 04:51 PM

    Script commands do not pass a return value. But script functions do. Some AE script functions, like CREATE_OBJECT, pass a return code directly in the return value. Others, like PREP_PROCESS_FILENAME, do not, and one must instead use SYS_LAST_ERR_NR & SYS_LAST_ERR_INS to read the return code.

    Is there a list of script functions whose return code & message must be retrieved in this way? Or is there a way to tell from the documentation? Moreover, can these error handling functions also be used to return errors from script commands, or do they work only with script functions?



  • 3.  Return value of PREP_PROCESS_FILENAME

    Posted Feb 09, 2018 02:20 AM

    ClausJambrich602320: I adapted your example into a JOBI. I also added the message type.

    UC0.PRINT_LAST_MESSAGE.JOBI

    ! UC0.PRINT_LAST_MESSAGE.JOBI: Capture and print error message :SET &ERR_NUM# = SYS_LAST_ERR_NR() :IF &ERR_NUM# <> "0" :  SET &MSG_TYP# = GET_MSG_TYPE(&ERR_NUM#) :  SWITCH &MSG_TYP# :  CASE "A" :    SET &MSG_TYP_LONG# = "Abort" :  CASE "E" :    SET &MSG_TYP_LONG# = "Error" :  CASE "I" :    SET &MSG_TYP_LONG# = "Information" :  CASE "Q" :    SET &MSG_TYP_LONG# = "Query" :  CASE "W" :    SET &MSG_TYP_LONG# = "Warning" :  CASE "C" :    SET &MSG_TYP_LONG# = "AWI/UI label" :  CASE "D" :    SET &MSG_TYP_LONG# = "Server message" :  ENDSWITCH :  SET &ERR_INS# = SYS_LAST_ERR_INS() :  SET &MSG_TXT# = GET_MSG_TXT (&ERR_NUM#,&ERR_INS#) :  PRINT "&MSG_TYP_LONG#:" :  PRINT "&MSG_TXT#" :ENDIF :SET &SYS_ERR# = SYS_LAST_ERR_SYSTXT() :IF &SYS_ERR# <> " " :  PRINT "System Error: &SYS_ERR#" :ENDIF


    You can then use this JOBI anywhere using a single :INCLUDE statement. E.g.,

    :SET &HND# = PREP_PROCESS_FILENAME("VWGSUP15_WS112_X64_01_SYS","c:\uc4\xyz\*","Y",,,,"UC_LOGIN=LOGIN.JAC") :INCLUDE UC0.PRINT_LAST_MESSAGE.JOBI,NOFOUND=IGNORE