ESP Workload Automation

 View Only
  • 1.  FILE_TRIGGER by file size and file creation date

    Posted Jul 27, 2023 01:42 PM
    Edited by Loren Watts Jul 27, 2023 01:49 PM

    Need some fancy help with FILE_TRIGGER. Unless that is the wrong object for this goal.

    I need to monitor a NAS folder for a file created after monitor begins or exists at the time the monitor begins.

    To satisfy the requirements:

    1. The file must be created today with today's filesystem date.

    2. The file must be of size greater than zero.
    The file shows up in the NAS file as size zero and then a process writes to the file, making it bigger than zero size.
    CREATE SIZE(1) is working for that raw requirement, but the older files also satisfy it.

    3. The APPL runs nightly. The file I'm targeting does not always grow beyond size 0. 
    If determined the file has no data (size remains zero), the appl generation for tonight should alert the owners.
    (This part is not my main concern at the moment.)

    The NAS folder contains numerous files from previous dates with the same base filename.
    The appl I'm working on only cares about today's file, based on modify date.
    My filter definition is FILENAME_REQ*

    Example filenames for discussion. The naming convention is consistent for base and datetime in filename -
    I am currently not filtering criteria using the date (072623 for example) in the name of the file.
    If that is doable in ESP, then I'd be game to use that logic.

    FILENAME_REQ_072623145053.txt
    FILENAME_REQ_62623230312.txt

    I've looked at the following documentation and didn't see a solution.

    I have not used UPDATE before, and don't understand if it would help in this situation.


    FILENAME Statement: Specify File to Monitor

    Broadcom remove preview
    FILENAME Statement: Specify File to Monitor
    The FILENAME statement specifies the name of the file to monitor for activity within a File Trigger job. The FILENAME statement also specifies the monitor conditions for the file trigger.
    View this on Broadcom >



  • 2.  RE: FILE_TRIGGER by file size and file creation date

    Posted Aug 09, 2023 09:47 AM
    Edited by Rick Romanowski Aug 09, 2023 09:48 AM
    You can use ESP Symbolics to get today's date.
     
    https://techdocs.broadcom.com/us/en/ca-mainframe-software/automation/ca-workload-automation-esp-edition/12-0/using/substitute-using-symbolic-variables/use-built-in-symbolic-variables.html
     
    ESP uses the following prefixes:
    ESPA
    Tells ESP to substitute the actual submission value (for example, the actual time an event is triggered).
    ESPS
    Tells ESP to substitute the scheduled value at the time of processing (for example, the scheduled time for an event to be triggered).
     
    Built-in symbolic variables represent the changeable components of the date parameter, as follows:
    • %ESPAMM represents the scheduled number of the month.
    • %ESPADD represents the scheduled day of the month.
    • %ESPAYY represents the scheduled 2-digit year.
    PROCEDURE_SECTION:                                                     
                                                                           
    APPL FTRGTEST                                                          
                                                                           
    PATH="<path where file is created>"                                               
                                                                           
    FILE_TRIGGER FILETRIG                                                   
      AGENT <Agent Name>                                                  
      FILENAME '%PATH/FILENAME_REQ_%ESPAMM%ESPADD%ESPAYY.*' CREATE SIZE(1) 
      RUN ANYDAY                                                           
      RELEASE JOB1                                                         
    ENDJOB                                                                 
                                                                           
    JOB JOB1 TASK SELFCOMPLETING                                           
      SEND 'File Trigger completed, Job1 run!' USER(*)                     
      SEND 'File:%ESPFTFILE..' USER(*)                                     
      RUN ANYDAY                                                           
    ENDJOB                                                                 
     
    I did a quick test for 3 files in the directory list below.
     
    ls -l
    total 4
    -rw-r--r-- 1 <user> <group> 0 Jul 25 08:38 FILENAME_REQ_072323_0-byte
    -rw-r----- 1 <user> <group> 0 Aug  9 09:19 FILENAME_REQ_080923_0-byte
    -rw-r----- 1 <user> <group> 2 Aug  9 09:19 FILENAME_REQ_080923_2-byte
     
    When Event is triggered:
     
    FILE TRIGGER COMPLETED, JOB1 RUN! ESP(<UserID>)                   
    FILE:<Path>/FILENAME_REQ_080923_2-BYTE. ESP(<UserID>)   
    ***                                                              
     

    Note: When displayed in ISPF %ESPFTFILE output is displayed in Upper case.
     
    Is that what you were looking for?



    ------------------------------
    Rick Romanowski
    rromanowski@ups.com
    Sr. Systems Analyst
    UPS
    NJ, USA
    ------------------------------



  • 3.  RE: FILE_TRIGGER by file size and file creation date

    Posted Sep 08, 2023 03:31 PM

    I'm not sure if you are still working on this.

    Let me know if you are?


    Thanks

    Rick



    ------------------------------
    Rick Romanowski
    rromanowski@ups.com
    Sr. Systems Analyst
    UPS
    NJ, USA
    ------------------------------



  • 4.  RE: FILE_TRIGGER by file size and file creation date

    Posted Sep 11, 2023 11:53 AM

    Thank you Rick. I think putting the symbolics into the FILENAME line should work for my situation. Thank you for your time and great answer.
    FILENAME_REQ_%ESPAMM%ESPADD%ESPAYY.*