ESP Workload Automation

Expand all | Collapse all

Possible to add date variable to a wobtrigs filename?

  • 1.  Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 12:22 PM

    Hello Forum,

    We are looking for a way to use an ESP v11.4 Event Wobtrig to monitor for files that would have the current day's date in them.

    For example  D:\yada\IM_20180323

    According to the book, symbolics are supposed to be legal in events but I think the fact that ESP puts single quotes around the filename is taking the symbolic literally without converting it.

    For example

    I tried

    WOBTRIG FILE_TRIGGER Agent(NT_CCCMSDAPP10) -
    FileName('D:\CYB_AGENT_R11\TEST\d%ESPAMMM*.txt') CREATE -
    State(Monitored) Status('Monitored for CREATE')

    but despite creating a dMARx.txt file the event did not fire.

     

    Our scheduling team needs to monitor for files named like IM_20180323

    tomorrows file would be IM_20180324

    next day's IM_20180325  and so on.

    For specific reasons they need to keep this at an Event wobtrig level and not an Appl file_trigger

    Anyone know if this is doable to get ESP date variables imbedded into the filename to be monitored?

    thanks



  • 2.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 12:59 PM

    Hi Michael, 

    I think it may be possible to get the variable resolved in the event

    But

    At midnight each day the event isn't going to send messages to the agent to delete the current file trigger and create a new file trigger. This would require manually saving the event. 

     

    Personally I think it would be best to schedule this at the application level and use the CONTINUOUS option. Each day a new job starts at midnight. This is fairly easy. 

     

    I tried this briefly. More testing needed.  Use an ESP batch step/job that runs at midnight with the JCL similar to the one below. The date value will be passed/resolved in the JCL.  ESP will delete and redefine the new trigger. The problem with this is that if the JCL gets stuck for two hours waiting on a initiator. I am still thinking about using a LINK PROCESS job. 

     

    //ESPBATCH JOB

    //S2 EXEC PGM=ESP,PARM='SUBSYS(subsys)'

    //STEPLIB DD DSN=prefix.SSCPLINK,DISP=SHR

    //SYSPRINT DD SYSOUT=*,DCB=LRECL=300

    //SYSIN DD *

    EVENT ID(POWDO03.DPFILEAA) SYSTEM(X114DPM) REPLACE
    INVOKE 'POWDO03.TEST.APPL(DPFILEAA)'
    WOBTRIG FILE_TRIGGER AGENT(AGENTU_01) -
    FILENAME('/opt/data/MARTXT') -
    CREATE
    ENDDEF

    /*

     

    Don



  • 3.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 01:27 PM

    Hi Don,

    I am not quite following… the jcl you posted was missing the date var in the filename.

    I interpreted that you are suggesting running a batch job nightly at midnight such as:

     

     

    //ESPBATCH JOB

     

    //S2 EXEC PGM=ESP,PARM='SUBSYS(subsys)'

     

    //STEPLIB DD DSN=prefix.SSCPLINK,DISP=SHR

     

    //SYSPRINT DD SYSOUT=*,DCB=LRECL=300

     

    //SYSIN DD *

     

    EVENT ID(POWDO03.DPFILEAA) SYSTEM(X114DPM) REPLACE

    INVOKE 'POWDO03.TEST.APPL(DPFILEAA)'

    WOBTRIG FILE_TRIGGER AGENT(AGENTU_01) -

    FILENAME('/opt/data/IM_%ESPAYEAR%ESPAMM%ESPADD*..TXT') -

    CREATE

    ENDDEF

     

    /*

     

    I tried that and the event still has the literals %ESPAYEAR%ESPAMM%ESPADD  in the event

    rather than IM_20180324

     

     

    Sent: Friday, March 23, 2018 12:00 PM

    To: Bieganski, Michael P:(BSC) <michael.bieganski@exeloncorp.com>

    Subject:  Re:  - Re: Possible to add date variable to a wobtrigs filename?

     

    CA Communities <https://communities.ca.com/?et=watches.email.thread>

     

     

    Re: Possible to add date variable to a wobtrigs filename?

     

    reply from powdo03<https://communities.ca.com/people/powdo03?et=watches.email.thread> in CA Workload Automation - View the full discussion<https://communities.ca.com/message/242052993-re-possible-to-add-date-variable-to-a-wobtrigs-filename?commentID=242052993&et=watches.email.thread#comment-242052993>



  • 4.  Re: Possible to add date variable to a wobtrigs filename?
    Best Answer

    Posted Mar 23, 2018 01:42 PM

    Hi Mike, 

    Using that JCL did you look for an event named POWDO03.DPFILEAA. This was my event name. You will also need to run it through ESP so the dates will be resolved. 

    I can give you a call if you would like. 

     

    My JCL looks like:

    EVENT ID(POWDO03.DPFILEAA) SYSTEM(X114DPM) REPLACE
    INVOKE 'POWDO03.TEST.APPL(DPFILEAA)'
    WOBTRIG FILE_TRIGGER AGENT(AGENTU_01) -
    FILENAME('/opt/data/%ESPAMMM..TXT') -
    CREATE
    ENDDEF

     

    This is the event that was defined with MAR. 

     

    /*************************************************/
    /* DEFINED BY POWDO03 AT 13.39 ON FRI 23MAR2018 */
    /* LAST RUN AT 15.21 ON WED 7MAR2018 */
    /* SUSPEND BY POWDO03 AT 17.47 ON FRI 18AUG2017 */
    /*************************************************/
    EVENT ID(POWDO03.DPFILEAA) SYSTEM(X114DPM) REPLACE
    INVOKE 'POWDO03.TEST.APPL(DPFILEAA)'
    WOBTRIG FILE_TRIGGER Agent(AGENTU_01) FileName('/opt/data/MAR.TXT') -
    CREATE State(Monitored) Status('Monitored for CREATE')
    ENDDEF

     

     



  • 5.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 02:35 PM

    here’s my jcl:

     

    //LTJI EXEC PGM=ESP,PARM='SUBSYS(ESPM)'

    //STEPLIB DD DSN=APF.JSS03DD.SSCPLINK,DISP=SHR

    //SYSPRINT DD SYSOUT=*

    //SYSUDUMP DD SYSOUT=*

    //SYSIN DD *

    EVENT ID(A#BIEGA.FILWOBTR)  SYSTEM(JSSM)  REPLACE

    COM FOR TESTING WOBTRIG EVENT

    COM     FILENAME('D:\CYB_AGENT_R11\TEST\D%ESPAMMM*.TXT')

    INVOKE 'A#BIEGA.JSS03DA.PROC(DUFUS)'

    WOBTRIG FILE_TRIGGER AGENT(NT_CCCMSDAPP10) -

    FILENAME('D:\CYB_AGENT_R11\TEST\D_%ESPAYEAR%ESPAMM%ESPADD*..TXT') -

            CREATE -

            STATE(MONITORED) STATUS('MONITORED FOR CREATE')

    ENDDEF

    /*

     

    When I ran it this is the event after the batch job ran:

     

    /*            LAST RUN AT 11.11 ON FRI 23MAR2018 */

    /*************************************************/

    EVENT ID(A#BIEGA.FILWOBTR)  SYSTEM(JSSM)  REPLACE

    COM FOR TESTING WOBTRIG EVENT

    COM     FILENAME('D:\CYB_AGENT_R11\TEST\D%ESPAMMM*.TXT')

    INVOKE 'A#BIEGA.JSS03DA.PROC(DUFUS)'

    WOBTRIG FILE_TRIGGER Agent(NT_CCCMSDAPP10) -

            FileName('D:\CYB_AGENT_R11\TEST\D_%ESPAYEAR%ESPAMM%ESPADD*..TX-

    T')     CREATE State(Monitored) Status('Monitored for CREATE')

     

     

    It didn’t convert any of the %ESPA vars in the event…it just copied them literally to the event.



  • 6.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 02:22 PM

    How many files per day?

    Will there be only 1 or can there be multiple?

    What if no file is received?


    Since the date will be changing every day wouldn't it be better to take action on any file that matching the pattern and then determine what action to take?

     

     

    For example  D:\yada\IM_YYYYMMDD

    WOBTRIG FILE_TRIGGER Agent(NT_CCCMSDAPP10) -
    FileName('D:\yada\IM_*') CREATE -
    State(Monitored) Status('Monitored for CREATE')

     

     

    Using the example above whenever a file is detected that matches D:\yada\IM_YYYYMMDD, then the ESP Symbolic %ESPFTFILE will contain the value.  you could then compare the substring[12:19] to check if it is today's date.

     

    Would that work?



  • 7.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 02:38 PM

    Hey Rick…in these particular cases, using just a wildcard like IM* doesn’t work as there can be hundreds or even thousands of different files

    (yes…they can make a dedicated folder but apparently the app folks do not want to do that for some reason)

     

    So to differentiate they only want files that have the current days date in the file name and no other…which is why we ask about

    %ESPA symbolics in the filename.

     

    thanks though



  • 8.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 03:21 PM

    Hi

    This definition worked for me with one important modifications. (Of course I had to change my agentname and other info)  

    I notice a couple of things. 

     

    In the JCL that is running remove the end. This is for after the dstrig has been created. 

     -

            STATE(MONITORED) STATUS('MONITORED FOR CREATE')

     

    Also look at the output of the JCL that is run to verify if it has any errors. 

     

    I would suggest putting these in a separate directory. The agent parsing hundreds/thousands of files every 30 seconds(default) can be a fair amount of overhead. Especially since this has an asterisk in it. Especially if there are multiple file triggers on this server the agent will struggle and may not function as well as it should. I think Rick's suggestion is the best method. 



  • 9.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 03:31 PM

    If there already is an agent installed on the Windows server, can the program that creates the file be a predeccessor job to the job that processes the file?



  • 10.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 03:40 PM
      |   view attached

    I think the schedulers can come up with work-arounds to make this work in a different manner, but they

    explicitly wanted to know if one can use the %ESPA date variables in the Event level wobtrig filename;

    (this current project is not the only one that has files created that have a date time stamp as part of the filename.

    Would have been simpler/cleaner if the Event would acknowledge the %ESPAYEAR etc etc in the filename…..but looks like no joy

     

    Thanks Rick



  • 11.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 03:35 PM
      |   view attached

    Removed the State(monitored) lines as suggested resulting in this jcl:

     

    //STEPLIB DD DSN=APF.JSS03DD.SSCPLINK,DISP=SHR

    //SYSPRINT DD SYSOUT=*

    //SYSUDUMP DD SYSOUT=*

    //SYSIN DD *

    EVENT ID(A#BIEGA.FILWOBTR)  SYSTEM(JSSM)  REPLACE

    COM FOR TESTING WOBTRIG EVENT

    COM     FILENAME('D:\CYB_AGENT_R11\TEST\D%ESPAMMM*.TXT')

    INVOKE 'A#BIEGA.JSS03DA.PROC(DUFUS)'

    WOBTRIG FILE_TRIGGER AGENT(NT_CCCMSDAPP10) -

    FILENAME('D:\CYB_AGENT_R11\TEST\D_%ESPAYEAR%ESPAMM%ESPADD*..TXT') -

            CREATE

    ENDDEF

     

    submitted…..got a cc 0.

     

                                                                                                                • Top of Data ********************************************************

    1ESP VER 11.4 BATCH INTERFACE                      14.32.40 FRIDAY MARCH 23RD, 2018

    0

    EVENT ID(AXX.FILWOBTR)      SYSTEM(JSSM)  REPLACE

    COM FOR TESTING WOBTRIG EVENT

    COM     FILENAME('D:\CYB_AGENT_R11\TEST\D%ESPAMMM*.TXT')

    INVOKE 'AXX.JSS03DA.PROC(DUFUS)'

    WOBTRIG FILE_TRIGGER AGENT(NT_CCCMSDAPP10)  FILENAME('D:\CYB_AGENT_R11\TEST\D_%ESPAYEAR%ESPAMM%ESPADD*..TXT')         CREAT

    ENDDEF

    ESP6912I DEFINITION IS DELAYED UNTIL CONFIRMATION IS RECEIVED FROM THE AGENT

                                                                                                              • Bottom of Data ******************************************************

     

     

     

    Event in E.3 still did not convert the %espa vars in the event



  • 12.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 03:55 PM
      |   view attached

    DUH!!!!   I know you told me…submit the job via ESP, but today my ears are ‘painted on’

    submitted the jcl from ESP (as you instructed) and the %ESPA vars converted in the event as you predicted:

     

    /*************************************************/

    EVENT ID(A#xx.FILWOBTR)  SYSTEM(JSSM)  REPLACE

    COM FOR TESTING WOBTRIG EVENT

    COM     FILENAME('D:\CYB_AGENT_R11\TEST\DMAR*.TXT')

    INVOKE 'A#xx.JSS03DA.PROC(DUFUS)'

    WOBTRIG FILE_TRIGGER Agent(NT_CCCMSDAPP10) -

            FileName('D:\CYB_AGENT_R11\TEST\D_20180323*..TXT') CREATE -

            State(Monitored) Status('Monitored for CREATE')

     

    Sorry for being thick-headed…must have started the weekend a few hours ahead

     

    Thanks guys I think we know have something to work with!



  • 13.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 04:26 PM

    Great.....it worked!!

    I would try to steer them to Rick's idea in a separate folder.... 



  • 14.  Re: Possible to add date variable to a wobtrigs filename?

    Posted Mar 23, 2018 04:24 PM

    Thanks Don, Thanks Rick...you gave us 2 good options to consider.  Appreciate your assistance with this.

    Best,