Automic Workload Automation

Expand all | Collapse all

Get variable values in tasks (JOBS) from GENERATE_SCRIPT_VARS in parent workflow (JOBP)

Jump to Best Answer
  • 1.  Get variable values in tasks (JOBS) from GENERATE_SCRIPT_VARS in parent workflow (JOBP)

    Posted 03-19-2019 09:46 AM

    Hi guys!!

     

     

    I created the following JOBI to read my VARA:

     

     

    :SET &job_env#= 'BRAPPSRVDEV'

     

    ! Setting variables for Project and Environment from VARA

     

    :   SET &RET# = GENERATE_SCRIPT_VARS("VARA.BR.&job_env#", APPEND_POUND_SIGN, UPDATE)

    :   PRINT ' ApplicationErrorThreshold = &ApplicationErrorThreshold# '

    :   PRINT ' BRSecurityCheckDivisionChange = &BRSecurityCheckDivisionChange#'

    :   PRINT ' DUExternalApplications = &DUExternalApplications#'

    :   PRINT ' DUExternalScripts = &DUExternalScripts#'

    :   PRINT ' DULogPathName = &DULogPathName#'

    :   PRINT ' MessagesOlderInMonths = &MessagesOlderInMonths#'

    :   PRINT ' PROCESSENVIRONMENT = &PROCESSENVIRONMENT#'

    :   PRINT ' SQLTimeOutErrorThreshold = &SQLTimeOutErrorThreshold#'

     

    !: Setting time variables

    :   SET &MONTHFORMAT# = "MM"

    :   SET &MONTH# = SYS_DATE(&MONTHFORMAT#)

    :   SET &YEARFORMAT# = "YYYY"

    :   SET &YEAR# = SYS_DATE(&YEARFORMAT#)

    :   SET &REFERENCEPERIOD# = &YEAR#&MONTH#

    :   PRINT "ReferencePeriod: &REFERENCEPERIOD#"

     

     

    I have added the include in the Process tab of my JOBP:

     

    :INC JOBI.BR.GET_BRAPPSRVDEV_VARIABLES

     

    I have 2 JOBS in the workflow.  Both of them have been setup with "All Variables Inherit from Parent" under their Variables tab.

     

    I can see that the include is working in the ACT report, but they are not being passed to the JOBS.  Can somebody tell me what the problem is?

     

    We are using version 12.2 and the setup to use function GENERATE_SCRIPT_VARS has been done. (=Y)

     

    Thanks in advance for your help :-)
    Mylene



  • 2.  Re: JOBI added to read JOBP to read VARA and pass parameters to JOBS

    Posted 03-19-2019 10:25 AM

    :PRINT &DULogPathName#

    :PRINT &REFERENCEPERIOD#

     

    :SET &HND# = PREP_PROCESS_REPORT("JOBS",, "PLOG")

    :SET &RET# = WRITE_PROCESS(&HND#,"&DULogPathName#\&job_env#_&$NAME#_&$PHYS_DATE_YYYYMMDD#.txt",WIN_WLA-P03, LOGIN.SERVICEACCOUNT.BR.BPMS,append)

     

    I forgot to mention that I was trying to get those VARA values in the second JOBS of my workflow, in the Post Process tab.

     

    So just to test, I added the include in the Pre Process of that same JOBS.  And it's not even working!!!  I can see that the values are there in the ACT report, but that's it!! I am definitely missing something here!!  :-(



  • 3.  Re: JOBI added to read JOBP to read VARA and pass parameters to JOBS

    Posted 03-20-2019 12:35 AM

    Did you try with PSET instead of SET?, to my knowledge, SET will pass variables only within the script level whereas PSET will pass the variables in object level.



  • 4.  Re: Get variable values in tasks (JOBS) from GENERATE_SCRIPT_VARS in parent workflow (JOBP)

    Posted 03-25-2019 05:23 PM

    I cannot use PSET with GENERATE_SCRIPT_VARS.  From what I can understand now is that this function is used only "on the fly". So How do I "pset" all the variables from my VARA where the key is the variable name and Value1 is the value in a JOBI ?



  • 5.  Re: Get variable values in tasks (JOBS) from GENERATE_SCRIPT_VARS in parent workflow (JOBP)

    Posted 03-26-2019 01:10 AM

    If you are testing the JOBI in your pre-process and try to access the values in Post-process, it won't work as those values will be available only to pre-process tab.

     

    Since it's a JOBI, why don't you use it directly in the Post Process tab of your second JOBS.



  • 6.  Re: Get variable values in tasks (JOBS) from GENERATE_SCRIPT_VARS in parent workflow (JOBP)

    Posted 03-29-2019 12:38 PM

    Those variables are generic variables that are going to be used in many tasks(JOBS) within a workflow (JOBP), and I don't want to have to include the JOBI in all my tasks.  I was told that I could load my VARA variables at the workflow level and have them available during the whole process, but I can't seem to find the right way to do it :-(

    Do you know if the code of the functions are available somewhere?  I would like to have a PSET_SCRIPT_VAR!!



  • 7.  Re: Get variable values in tasks (JOBS) from GENERATE_SCRIPT_VARS in parent workflow (JOBP)
    Best Answer

    Posted 04-01-2019 09:42 AM

    Here is the solution:

     

     

    :SET &job_env#= 'BRAPPSRVDEV'

     

    ! Setting variables for Project and Environment from VARA

     

    :   SET &RET# = GENERATE_SCRIPT_VARS("VARA.BR.&job_env#", APPEND_POUND_SIGN, UPDATE)

    :   PUB &ApplicationErrorThreshold# '

    :   PUB &BRSecurityCheckDivisionChange#'

    :   PUB &DUExternalApplications#'

    :   PUB &DUExternalScripts#'

    :   PUB &DULogPathName#'

    :   PUB &MessagesOlderInMonths#'

    :   PUB &PROCESSENVIRONMENT#'

    :   PUB &SQLTimeOutErrorThreshold#'

     

    !: Setting time variables

    :   SET &MONTHFORMAT# = "MM"

    :   SET &MONTH# = SYS_DATE(&MONTHFORMAT#)

    :   SET &YEARFORMAT# = "YYYY"

    :   SET &YEAR# = SYS_DATE(&YEARFORMAT#)

    :   SET &REFERENCEPERIOD# = &YEAR#&MONTH#

    :   PRINT "ReferencePeriod: &REFERENCEPERIOD#"