Automic Workload Automation

Expand all | Collapse all

Context-aware JOBI that runs different commands in pre-process/process vs. post-process

  • 1.  Context-aware JOBI that runs different commands in pre-process/process vs. post-process

    Posted Jan 15, 2018 05:48 AM
    I have an include object that I would like to generalize so that it can be used in any scripting tab of any executable object.

    The JOBI is the one I made to create a static VARA object if it does not already exist. As written, the JOBI is designed to run in the post-process tab of a job, and as such, uses the :MODIFY_STATE command to make the job end in error if an error is encountered. This scripting command cannot be used in the pre-process or process tab though; there, one muse use the :STOP command instead to stop the job during the activation phase.

    I would like to make the JOBI context-aware, so that:
    1. It recognizes whether it is running in the pre-process/process tab or the post-process tab; and
    2. It uses the:STOPcommand in the first case, and the:MODIFY_STATEcommand in the second.
    Is there a way to do this?


  • 2.  Context-aware JOBI that runs different commands in pre-process/process vs. post-process

    Posted Jan 15, 2018 06:13 AM
    We do differ between PRE- and POSTscript by checking with GET_UC_OBJECT_STATUS.

    If GET_UC_OBJECT_STATUS returns < 1573 its Prescript
    and if > 1573 its running or POSTScript

    thats detailed enough to set some values (PREscript) or get some values (POSTscript)

    cheers, Wolfgang




  • 3.  Context-aware JOBI that runs different commands in pre-process/process vs. post-process

    Posted Jan 15, 2018 07:57 AM
    Wolfgang Brueckler said:
    If GET_UC_OBJECT_STATUS returns < 1573 its Prescript
    and if > 1573 its running or POSTScript
    Thanks, Wolfgang. I added a bit of scripting to perform this check:
    :PRINT "Checking task status to determine the active scripting tab."
    :SET &Task_Status# = GET_UC_OBJECT_STATUS()
    :PRINT "Task status: &Task_Status#"
    :IF &Task_Status# < 1573
    :  SET &Active_Tab# = "pre-process or process"
    :ELSE
    :  SET &Active_Tab# = "post-process"
    :ENDIF
    :PRINT "Running in &Active_Tab# tab."
    Then, elsewhere in the JOBI, in every place where the job must be stopped or ended in error, I added an :IF statement to check the value of &Active_Tab#. E.g.,
    :  PRINT "Creating VARA object &Static_VARA_Name#."
    :  SET &RC#= CREATE_OBJECT(VARA,&Static_VARA_Name#,&Static_VARA_Path#,&Static_VARA_Title#,"I","C","FREE")
    :  IF &RC# <> 0
    :    SET &RC# = FORMAT(&RC#)
    :    PRINT "Error &RC# when attempting to create object &Static_VARA_Name#."
    :    IF &Active_Tab# = "post-process"
    :      MODIFY_STATE RETCODE=8
    :      MODIFY_STATE STATUS_TEXT="CREATE_OBJECT RC: &RC#"
    :    ELSE
    :      STOP NOMSG,51,"CREATE_OBJECT RC: &RC#"
    :    ENDIF
    :  ELSE
    :    PRINT "Successfully created object &Static_VARA_Name#."
    :    SET &Static_VARA_Created# = "YES"
    :  ENDIF
    This works fine, and I have updated my JOBI for creating a static VARA. Thanks for your help.


  • 4.  Context-aware JOBI that runs different commands in pre-process/process vs. post-process

    Posted Jan 15, 2018 08:00 AM
    You 're very & always welcome :-)