ESP Workload Automation

 View Only
  • 1.  Trigger ESP application when file is created and pass parameter to the file argument

    Posted Jul 07, 2017 12:04 PM

    We have one distributed application that runs once a day, however we need to make some adjustment to run every time a file is created, all jobs need to have a qualifier " could be the number pass from a file", and also pass the same number to the argument. File could be created every 5 seconds.



  • 2.  Re: Trigger ESP application when file is created and pass parameter to the file argument

    Posted Jul 07, 2017 02:03 PM

    Hello,

     

    Could you post more details on which system the file is created? 

     

    If you are going to monitor the file occurrence from ESP, I'd suggest to use WOBTRIG statement inside the event as mentioned below

     

    EVENT ID(ITSSCHD.TESTGSN) SYSTEM(ESPM) REPLACE
    INVOKE 'ITNP.ESP.TESTPROC(TESTAPP1)' 
    WOBTRIG FILE_TRIGGER Agent() -
    FileName('') CREATE/UPDATE 

     

    File name could also be a wild card statement, in such cases add an * at last.

     

    As soon as event is triggered for a file arrival, %ESPWTFILE would store the complete input file along with whole path. You could use substring function to split the characters of the file and pass the same to Qualifier name and Arguments according to your requirement.

     

    Inside TESTAPP1    

     

    QUAL = SUBSTR(x,x,%ESPWTFILE)

    UARG = SUBSTR(x,x,%ESPWTFILE)

     

    UNIX_JOB TESTAPPL.%QUAL

                        RUN DAILY

                        SCRIPTNAME ***

                        ARGS %UARG

                        ENDJOB

     

    Hope this information helps.#wobtrigs #esp_events 



  • 3.  Re: Trigger ESP application when file is created and pass parameter to the file argument

    Posted Jul 10, 2017 10:36 AM

    This is a windows OS, file trigger is going to be something like 'D:\Filename\ACC001.txt'. The ACC# is different every time it runs, however I want that number to be pass to qualifier and argument. I need to understand how the SUBSTR function work, does the drive and slash count as part of the stream?, if it doesn’t them it should look like the following example, please let me know If is ok.

    The ‘*’ represent the field that need to be pass, which it could be ACC001, ACC002, etc, etc..

    EVENT ID(ESP.APPL01) SYSTEM(ESPQA) REPLACE

    INVOKE ‘ESP.TEST.PROC(APPL01)' 

    WOBTRIG FILE_TRIGGER Agent(SERVERNAME03) -

    FileName('D:\Filename\*.txt') CREATE/UPDATE 

    APPL APPL01

     

    QUAL = SUBSTR(8,6,%ESPWTFILE)

    WARG = SUBSTR(8,6,%ESPWTFILE)

     

    Agent SERVERNAME03

     

    NT_JOB JOB015DS.%QUAL

       RUN WORKDAYS

       CMDNAME D:\FileName\Incoming

       ARGS %WARG

    ENDJOB



  • 4.  Re: Trigger ESP application when file is created and pass parameter to the file argument
    Best Answer

    Posted Jul 10, 2017 11:00 AM

    If your file is going to be D:\Filename\ACC001.txt then %ESPWTFILE would have the complete file name as I already mentioned. so while doing SUBSTR, You would need to count each character as 1 which would also include space if there is any. 

     

    I've just re-modified the same example you took.

     

    EVENT ID(ESP.APPL01) SYSTEM(ESPQA) REPLACE

    INVOKE ‘ESP.TEST.PROC(APPL01)' 

    WOBTRIG FILE_TRIGGER Agent(SERVERNAME03) -

    FileName('D:\Filename\*') CREATE/UPDATE - Changed this from 'D:\Filename\*.txt' to 'D:\Filename\*' to process wildcard

     

    APPL APPL01

     

    QUAL = SUBSTR(13,7,%ESPWTFILE) - changed the values considering total length of the file name as 22

    WARG = SUBSTR(13,7,%ESPWTFILE)

     

    Agent SERVERNAME03

     

    NT_JOB JOB015DS.%QUAL

       RUN WORKDAYS

       CMDNAME D:\FileName\Incoming

       ARGS %WARG

    ENDJOB

     

    Hope it helps !!