AutoSys Workload Automation

  • 1.  Workload Automation DE - defining a variable based on a file monitor

    Posted Feb 07, 2019 10:43 AM

    Hello I have an application with multiple file monitor jobs defined. I'm looking for a way to capture the information from a single file monitor and pass that value to dependent jobs. I've tried using %APPL._ftfile but this will return the value from any file monitor in the Application that has executed.

     

    I attempted to created a unique variable with the following java script but again using APPL._ftfile uses the value from the most current file monitor that completed.

     

    // Get the actual filename and filepath of the file which
    // satisfied the previous File Trigger WOB in this Application

    if (APPL._loadmode == 'false') {
    var temp = APPL._ftfile;
    var start = temp.lastIndexOf('\\');
    APPL.ftfilename = temp.substr(start + 1);
    APPL.ftfilepath = temp.substr(0,start);
    }

     

    Is there a WOB version of _ftfile? Or can someone help me javascript a job-level variable that I can add into a LINK that sets the path/file name I can pass to dependent jobs?

     

    Thanks,

    Ken Ski



  • 2.  Re: Workload Automation DE - defining a variable based on a file monitor
    Best Answer

    Broadcom Employee
    Posted Feb 07, 2019 01:58 PM

    There is no WOB version of _ftfile variable but you can capture the path/file name of a file monitored in FT job, and use it in successor jobs;

    - Define a Link job as a successor job to the File Trigger job you want to capture the path/file name.

    - In the Link job, define a javascript at run time to capture the path/file name. Example;

    APPL.ftfile = APPL._ftfile;

    - Use the %APPL.ftfile variable in successor jobs.



  • 3.  Re: Workload Automation DE - defining a variable based on a file monitor

    Posted Feb 07, 2019 02:25 PM

    I get a Undefined error when I run simulate. Will it not resolve in a simulate scenario? Attached is a screen shot of my setup and the result of simulate.

     



  • 4.  Re: Workload Automation DE - defining a variable based on a file monitor

    Broadcom Employee
    Posted Feb 07, 2019 02:57 PM

    It's run time javascript, you can run it to verify the setup.



  • 5.  Re: Workload Automation DE - defining a variable based on a file monitor

    Posted Feb 07, 2019 03:10 PM

    It worked. Thanks you!!



  • 6.  Re: Workload Automation DE - defining a variable based on a file monitor

    Posted Feb 25, 2019 08:02 AM

    Olusegun, I found the answer to my original question. It appears we were already doing this for another application.

     

    var temp = APPL.ftfilename;

    APPL.xxfilename = temp;

    APPL.yyfilename = temp.replace(/xx/, 'yy');



  • 7.  Re: Workload Automation DE - defining a variable based on a file monitor

    Posted Feb 25, 2019 08:05 AM

    Sorry the complete answer is APPL.xxfilename is the value from the EVENT File Monitor job. The for each JOB you can change the VALUE with the temp.replace(/original value/, 'new value'); 



  • 8.  Re: Workload Automation DE - defining a variable based on a file monitor

    Posted Feb 19, 2019 08:42 AM

    Hi Olusegun, this issue of two WINDOWS File Monitor jobs running parallel in the same application caused the system variable (APPL.ftfile = APPL._ftfile;) to pick up the wrong path again causing the job to fail.

     

    Can the "APPL" be changed to WOB and be for a specific job? The only other option I can think of is delaying the job stream x-minutes before running.

     

    The issue is multiple file monitor jobs running parallel in the same application. Any job in the application coded to use APPL._ftfile will pick up whichever file monitor ran last.

     

    Here is the Manuals Definition for APPL._ftfile:

    Use %APPL._ftfile when you need the name of the file monitored in a file trigger job. The variable resolves to the last file trigger that occurred within the Application. For example, you can use this variable in a successor job to process a file that caused the file trigger to occur.