ESP Workload Automation

  • 1.  Multiple files during a file trigger

    Posted Jun 03, 2011 12:46 PM
    So here is the situation,

    I am in need of making a job wait for a set of files. But if one of the files comes in i would like the jobs to start. the problem i have is that i don't know when or what file will be coming in. It is completely random. Is there any way to have a File trigger wait for multiple files but kick off if one of them comes in?


  • 2.  RE: Multiple files during a file trigger

    Posted Jun 03, 2011 01:39 PM
    Try the RELCOUNT on the job that is waiting for multiple files. See example below wherein the JOB (link process) is waiting on any one of three dataset triggers to kick off.

    DOWLING: ESPPROC
    APPL TESTDOWL INDEX(3)
    DSTRIG DATA1
    DSNAME 'ME24948.SUPERC.LIST'
    RUN ANY
    RELEASE ENDLINK
    ENDJOB
    DSTRIG DATA2
    DSNAME 'ME24948.GDG1-'
    RUN ANY
    RELEASE ENDLINK
    ENDJOB
    DSTRIG DATA3
    DSNAME 'ME24948.GDG2-'
    RUN ANY
    RELEASE ENDLINK
    ENDJOB
    JOB ENDLINK LINK PROCESS
    RELCOUNT 2 /* START EXECUTION WHEN THE HOLD COUNT IS */
    /* RATHER THAN ZERO IN THE ABSENCE OF THE RELCOUNT */
    SE ' HELLO %ESPEVENT IS OVER ' U(*)
    RUN ANY
    ENDJOB

    Now the challenge of doing something like the above with the RELCOUNT is how do you handle the two dataset triggers that were not posted first. I don't know know if you should WITHDRAW them from the appl or force complete them or do something else entirely different.

    Hope this helps.

    Michael E. Ellis
    Systems Programmer
    Deere & Company


  • 3.  RE: Multiple files during a file trigger

    Posted Jun 03, 2011 01:44 PM
    I had a similiar request. Here is what I coded, its a little convoluted. The job could be triggered based on one or the other file coming in. I also had to complete the appl is the files did not come in at all.

    FILE_TRIGGER LEVOE_SBMDODS_FT
    AGENT CINSCHEDFSTST01
    FILENAME '\\CITRIXSBM1T\SBMRPTS\ODS\SBMDODS.DON' CREATE
    USER ws\_levoe_t
    RELEASE ADD(LEVOE_SBMMAIN)
    RELEASE ADD(LEVOE_TERM_SBMMODS)
    RUN WORKDAYS
    /* NOTIFY FAILURE ALERT(SUB)
    ENDJOB

    FILE_TRIGGER LEVOE_SBMMODS_FT
    AGENT CINSCHEDFSTST01
    FILENAME '\\CITRIXSBM1T\SBMRPTS\ODS\SBMMODS.DON' CREATE
    USER ws\_levoe_t
    RELEASE ADD(LEVOE_SBMMAIN)
    RELEASE ADD(LEVOE_TERM_SBMDODS)
    RUN WORKDAYS
    /* NOTIFY FAILURE ALERT(SUB)
    ENDJOB


    JOB LEVOE_TERM_SBMDODS TASK SELFCOMPLETING
    RUN WORKDAYS
    ESP AJ LEVOE_TERM_SBMMODS COMPLETE APPL(LEVSBMTS.%ESPAPGEN)
    ESP AJ LEVOE_SBMDODS_FT COMPLETE APPL(LEVSBMTS.%ESPAPGEN)
    ENDJOB

    JOB LEVOE_TERM_SBMMODS TASK SELFCOMPLETING
    RUN WORKDAYS
    ESP AJ LEVOE_TERM_SBMDODS COMPLETE APPL(LEVSBMTS.%ESPAPGEN)
    ESP AJ LEVOE_SBMMODS_FT COMPLETE APPL(LEVSBMTS.%ESPAPGEN)
    ENDJOB


    NT_JOB LEVOE_SBMMAIN
    AGENT CINSCHEDTST03
    CMDNAME C:\ESP\Apps\levoe\dwsbmdaily.bat
    USER ws\_levoe_t
    RELEASE ADD(LEVOE_COMPLETE_TASKS)
    RUN WORKDAYS
    EXITCODE 00 SUCCESS
    ENDJOB

    JOB LEVOE_COMPLETE_TASKS TASK SELFCOMPLETING
    RUN WORKDAYS
    ESP AJ LEVOE_TERM_SBMDODS COMPLETE APPL(LEVSBMTS.%ESPAPGEN)
    ESP AJ LEVOE_TERM_SBMMODS COMPLETE APPL(LEVSBMTS.%ESPAPGEN)
    ENDJOB

    JOB LEVOE_COMPLETE_APPL TASK SELFCOMPLETING
    DELAYSUB 23:50
    RUN WORKDAYS
    ESP AJ ALL COMPLETE APPL(LEVSBMTS.%ESPAPGEN)
    ENDJOB


  • 4.  RE: Multiple files during a file trigger

    Posted Jun 03, 2011 01:57 PM
    if it is possible to have your filetrigger monitor the files with a wild card.
    The first file that matches the wildcard patern will complete the monitor and you are set.

    if the wildcard method is not an option then you wll need to us the motheds already listed, using the relcount to manipulate how many file triggers are needed to release you job.


  • 5.  RE: Multiple files during a file trigger

    Posted Jun 03, 2011 02:09 PM
    I suppose i could just do a *.txt create recursive since the files come into different subfolders. I will try this if that doesn't work i will start testing the other ways listed.
    Thanks for the replies.

    Dustin N.


  • 6.  RE: Multiple files during a file trigger

    Posted Mar 18, 2013 02:09 PM
    i have scenario as below . can someone pl let me know how to handle this.

    1) i can get multiple trigger files throughout the day. Each trigger file has data file associated with it.
    2)i was thinking of having file watcher job in T_FW table , and the processing jobs in T_PROCESS table.

    Can you pl let me know how to achive the below.
    1) File trigger job in T_FW should load T_PROCESS table when it finds the trigger file . If T_PROCESS is currently running or in failed status then it should wait till no T_PROCESS is running . T_FW should keep loading automatically after it detects the trigger file.

    Pl note that the processes has to run continously.


  • 7.  RE: Multiple files during a file trigger

    Posted Mar 19, 2013 05:27 AM
    Hi dwarch,

    When you say T_FW table or T_PROCESS table, by table do you mean an ESP Application?

    If so, how about something like this (I haven't tested it, just theorising)? The file trigger job in T_FW can be a CONTINUOUS monitor using an ESP Alert to retrigger itself every time it completes (if the trigger job is the only job in the Application, you may need a Manual Task in there to keep it active), and also the Event for T_PROCESS, using the APPLJOB (AJ) and TRIGGER cmds:

    AJ <jobname> RESUB APPL(T_FW.%ESPAPGEN)
    TRIGGER <pref.eventname>


    In the application definition for T_PROCESS have 'APPLICATION T_PROCESS WAIT' coded to make it wait for the previous generation to complete before starting. If there are multiple T_PROCESS Application triggers they will stack up in order and run oldest first.

    Regards,
    John


  • 8.  RE: Multiple files during a file trigger

    Posted Mar 19, 2013 10:33 AM
    Thanks John , yes by table i mean application. If possible can you pl put the sample code for both the apps.


  • 9.  RE: Multiple files during a file trigger

    Posted Mar 19, 2013 01:23 PM
    OK will try to put something together but won't be for a couple of days as I am on the road now.


  • 10.  RE: Multiple files during a file trigger

    Broadcom Employee
    Posted Mar 26, 2013 05:45 PM
    You may find Knowledge document TEC479827 on support.ca.com helpful.

    I copied it here, and add a bit more to accomodate to your case:
    Title: Example to use FILE_TRIGGER with CONTINUOUS(*)


    Description:

    We need to implement FILE_TRIGGER with CONTINUOUS(*), but don't know how to have FILE_TRIGGER in the same ESP Proc as the agent workloads.

    Solution:

    Using CONTINUOUS(*) allows you to avoid defining an alert. Also adding IF logic can make FILE_TRIGGER and agent workload stay in same ESP Proc, even though different APPL generations will be created.

    Here is an example
    IF %MNJOB NE '' THEN
    /* this means file_trigger occurs */
    DO
    APPL AGTJOBS WAIT
    /* define all the agent JOBs that should run after the FILE_TRIGGER fires */

    NT_JOB TESTA
    ...
    ENDJOB
    UNIX_JOB TESTB
    ...
    ENDJOB
    ....
    ENDDO
    ELSE
    DO
    APPL FILETR
    /* define the FILE_TRIGGER with CONTINUOUS(*) */
    FILE_TRIGGER FILE1
    FILENAME file_name1 CREATE CONTINUOUS(*)
    ...
    ENDJOB
    FILE_TRIGGER FILE2
    FILENAME file_name2 UPDATE CONTINUOUS(*)
    ...
    ENDJOB
    ..
    ENDDO

    Note: you can find more examples under FILENAME on Command Reference Guide.

    Hope this helps,

    Lucy