Automic Workload Automation

 View Only
Expand all | Collapse all

Syntax error in Post-Process of REST job because response array variable is not defined

  • 1.  Syntax error in Post-Process of REST job because response array variable is not defined

    Posted Nov 30, 2022 09:58 AM

    I'm seeing an error like this when trying to run a REST job:

    U00021719 Syntax error in object 'EBM.GET_TASKS_BY_NAME.JOBS_REST(2)', line '00098'. 'U01001308 Variable 'REMOTE_TASK_RUNID#' has not yet been defined.'.


    &REMOTE_TASK_RUNID# is set in the REST job Response tab, and is an array.

    The variable will not be defined if the number of results returned was 0. However, the relevant line in the in the Post-Process will also not be executed if the number of results is 0. This is not a runtime error, but a syntax error. This tells me that the AE is not even trying to run the Post-Process. (If it did, it would probably run fine.)

    What's the way around this? Is it really necessary to :DEFINE every array variable at the top of the Post-Process if the value of the variable is referred to later in the script?

    The nice thing about the Response tab of REST jobs is that arrays are defined only if they're needed. It seems that the value of this feature is undermined by the AE's overzealous syntax checker.



  • 2.  RE: Syntax error in Post-Process of REST job because response array variable is not defined

    Posted Nov 30, 2022 10:06 AM
    Edited by Michael A. Lowry Nov 30, 2022 10:12 AM

    Well, I answered my own question. Realizing that the AE's syntax checker is not very clever, I solved the problem by adding this to the top of the job Post-Process:

    ! Fake declarations to fool AE syntax checker.
    :IF 1 = 0
    :  DEFINE &REMOTE_TASK_RUNID#,STRING, 100
    :  DEFINE &REMOTE_TASK_STATUS#,STRING, 100
    :  DEFINE &REMOTE_TASK_PARENT,STRING, 100
    :  DEFINE &REMOTE_TASK_ALIAS#,STRING, 100
    :  DEFINE &REMOTE_TASK_ACT_TIME#,STRING, 100
    :  DEFINE &REMOTE_TASK_END_TIME#,STRING, 100
    :ENDIF


    The job works fine.




  • 3.  RE: Syntax error in Post-Process of REST job because response array variable is not defined

    Posted Dec 06, 2022 11:10 AM
    Edited by Michael A. Lowry Dec 06, 2022 11:25 AM