Automic Workload Automation

 View Only
Expand all | Collapse all

How to share dynamically loaded VARA in JOBP to JOBSs???

  • 1.  How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 20, 2019 02:32 AM
    As a newbie to One Automation, I require help in resolving an issue.  
    I created a static VARA object (VARA.MYFILE) which stores a set of variables and their values.
    In my JOBP workflow under Process I have inserted the following line to dynamically load the VARA variables and their values.
    :SET &RET# = GENERATE_SCRIPT_VARS("VARA.MYFILE", APPEND_POUND_SIGN, UPDATE)

    I printed out the values of each of the loaded variables in the workflow.   This works ok.

    Within the workflow I created a set of JOBS.  Some of the JOBS require access to one or more of the VARA variables values that were loaded in the workflow.  When I printed the out the values of the loaded variables within the JOBS the values are undefined.

    How does one pass the dynamically loaded variables from the JOBP to the JOBS?

    ------------------------------
    Newbie
    ------------------------------


  • 2.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 20, 2019 03:02 AM
    Hi

    if you know the variable names upfront you can put them into the Variables&Prompts tab.

    if not pls have a look at the script command : PSET
    : RSET could work too but here i am not sure by heart

    cheers, Wolfgang

    ------------------------------
    I know I do really know it!
    ------------------------------



  • 3.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 20, 2019 07:24 AM
    Thanks for the reply.
    I had found the :PSET worked for variable names that are known.    For example:  Placing :PSET &start_step# = 100 in JOBP that all JOBS under JOBP have access to this variable.

    So, if  I know all the variable names upfront then I could declare them and use :PSET.   However I am seeking a method to allow my VARA variable list to be dynamic.
    Using :PSET as-in :PSET &RET# = GENERATE_SCRIPT_VARS("VARA.MYFILE", APPEND_POUND_SIGN, UPDATE) does not appear to share the variables.
    Unfortunately, I was not successfully in getting :RSET to allow these dynamically created variables to be shared.
    If you could provide an example code snippet then that would be great.

    ------------------------------
    Newbie
    ------------------------------



  • 4.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 20, 2019 03:44 PM
    hi
    damn I would have bet that this does the trick.

    sry, no other Idea at the moment....

    cheers, Wolfgang

    ------------------------------
    I know I do really know it!
    ------------------------------



  • 5.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 20, 2019 07:48 PM
    Is there a way to grab the list of variables associated with a workflow?   If so, maybe it's possible to loop through the list and apply :RSET or :PSET

    ------------------------------
    Newbie
    ------------------------------



  • 6.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 21, 2019 07:46 AM
    Hi

    theres no easy or direct way - you could use a SQL statement but thats a bit tricky and not 100% safe.
    I personally would not use generate_script_vars :-)

    by the way what do you want to do or archieve with the script variables in the VARA object?
    cheers, Wolfgang

    ------------------------------
    I know I do really know it!
    ------------------------------



  • 7.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???
    Best Answer

    Posted Sep 21, 2019 12:29 PM
    If you have the name of the variable + value in the VAR you can use PRE_PROCESS_VAR to list content and use a PUBLISH command to share the variables and values.

    You execute it in the PRE_PROCESS sorry PROCESS of the workflow and if jobs are set to inherit variables from parent they will be able to get the information. Sample below is just a sample, don't take it for immaculate truth please !

    :SET &varlist# = PREP_PROCESS_VAR(VARA.MYFILE)
    :PROCESS &varlist#

    :    SET &varname# = GET_PROCESS_LINE(&varlist#,1)     =>  this is the key/index field where you have set your variable name without & ( and # )
    :    SET &varname# = STR_CAT(&varname#,"#")                   =>  add the # at end of the variable name (not required if name of the variable already have it)

    :    SET &value# = GET_PROCESS_LINE(&varlist#,2)           =>  get the value that you have stored in the object variable and that will be passed to jobs

    :    PUBLISH &value#, &varname#, "TASK"                             =>  put info in a buffer that is available for all objects in the workflow

    :ENDPROCESS


    Just be careful if you need to use multiple workflows nested. Then you may use another parameter than TASK in the PUBLISH command
    ( see doc for details)

    Regards.
    Alain



    ​​


  • 8.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 21, 2019 01:19 PM
    The purpose is to avoid having to statically define variables in each JOBS under a JOBP.    For example, if I have a JOBP with 50 JOBS and combined these JOBS use 100 script variables that are defined in a VARA.  Then it would be to efficient to load in the JOBP all those variables and have those variables available for all JOBS to use.

    ------------------------------
    Newbie
    ------------------------------



  • 9.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 23, 2019 03:05 AM
    Hi Gerald,

    how about using an array? If you need names instead of array-Place-Numbers, you could use one array for the Variable Names and one Array for the Values.

    It's just an idea, I haven't had such a requirement yet. I guess, things might get very complicated if you design your tasks in such a general way.

    Regards, Nicole

    ------------------------------
    Regards, Nicole
    ------------------------------



  • 10.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 23, 2019 05:26 AM
    Hi Gerald,

    I do not have that much variables. But I would suggest to put them into thematically grouped PROMPTSETs. You can refer to the values in the VARA using the {}-notation. It can either be done in the workflow or directly in the promptset defintion als default values. This would then enable you to reuse it with ease.

    I am using this method in CDA to fetch all the settings for the around 20 Oracle DB details. Even if I need to refer to custom types instead of a VARA, it is comparable.

    Regards,
    Juergen

    ------------------------------
    Senior Consultant
    setis GmbH
    ------------------------------



  • 11.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 23, 2019 04:00 AM
    Hi Gerald,
    just a question: did you set "Generate at runtime" for your workflow tasks? If not, the tasks will be generated before the variables will be created by the workflow. This way they cannot get the variables. The variables of the parent object must be available and set before the generation of the child objects.

    ------------------------------
    Regards, Nicole
    ------------------------------



  • 12.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 23, 2019 12:57 PM
    ​Thanks everyone for your replies.  I decided to Alain Moisy's solution - adding it to the workflow.  Interestingly, I had tried the PREP_PROCESS_VAR before but had mistakenly used PUBLISH &varname#, &value#, "TASK"  instead of PUBLISH &value#, &varname#, "TASK" .   Thanks Alain for the code snippet.   To override the workflow variables in JOBS that may require different set of values, I use the GENERATE_SCRIPT_VARS.

    As the VARA file will grow over time, I did not know the size of the ARRAY which is why I did not choose that option.  

    What is a "thematically grouped PROMPTSETs"?

    ------------------------------
    Newbie
    ------------------------------



  • 13.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 24, 2019 04:12 AM
    Good morning,

    since a promptset is something static, it is a lot of work to get around 100 variables into it. This does only make sense when you are able to reuse it. The best way of doing this is to create different promptsets for different purposes. I do not know what is the content of your VARA. So I mentioned the context where I was using it. I have created a promptset for Oracle DB data. I attach it to every JOBP that is accessing the DB in some way. My next will be connected to the IBM Websphere Message Broker.
    A VARA feeding data into an array might be a more flexible way of doing the job. But regarding the overview of the possbile data and documentation the work you will invest into a couple of promptsets is not that bad. You will need to touch every new value once.

    Regards,
    Juergen

    ------------------------------
    Senior Consultant
    setis GmbH
    ------------------------------



  • 14.  RE: How to share dynamically loaded VARA in JOBP to JOBSs???

    Posted Sep 25, 2019 12:35 AM
    My PromptSet now dynamically loads a combo-box with VARA files of specific types (Oracle DB data, SAS data, etc.).   Each of the JOBS include the correct PromptSet and workflow (JOBP) also includes Promptset.   At the JOBP, the dynamically loaded VARA script variables are published to TASKs.  At the JOBS level, if PromptSet is set then the selected VARA file is load otherwise the JOBS uses the VARA file contents from the JOBP.   Thus, if all JOBS in a JOBP require the use of a single VARA then only the JOBP PromptSet must be used.   On the other side, if one or a few JOBS require a VARA file other than the VARA file selected in JOBP, than that's possible too.  New VARA files can easily be created and they will dynamically be available.  Great for testing.

    Thanks everyone for the great ideas and support.

    ------------------------------
    Newbie
    ------------------------------