3 Replies Latest reply on Jul 10, 2020 8:41 AM by Bentze Perlmutter

    File_watcher_Job - FileName

    Marouen Kahia
      Share This:

      Hello!

      Need to perform the following processing:

      When receiving any file with a name that begins with 'prlv' another job must be executed, knowing that the numbers following the word 'prlv' consist of a date and a sequential number.

       

      NB: If we put the full name of the file, the job ended OK

      I think there are some variables to configure, right?

       

      Thank you in advance.

       

      Marouen Kahia

        • 1. Re: File_watcher_Job - FileName
          Bentze Perlmutter

          Hi Marouen,

           

          You can use wild cards in the filename to watch.

          e.g.

          prlv*

          or

          prlv_??????_?????_*

           

          * = any number of characters

          ? = single character

           

          If you know that the date in the file is always current_date, and you don't want to use wild cards for the date because that may pickup a previous day's file, you can use one of the Control-M System Variables for date.

          e.g.

          For current date in YYYYMMDD format: prlv_%%$DATE.* (the dot is to concatenate values so is required in this example)

          For current date in YYMMDD format: prlv_%%DATE.*

          For Control-M Order Date (=Business Date) in YYYYMMDD format: prlv_%%$ODATE.*

          For Control-M Order Date (=Business Date) in YYMMDD format: prlv_%%ODATE.*

           

          In all of the above, Control-M resolves the variable to a value at the time the job gets submitted and then the file watcher looks for that value.

          Exmaple:

          prlv_%%$DATE.* will be resolved to prlv_20200710* and the value being searched for will be prlv_20200710*.

           

          You can read more about Control-M Variables here: Control-M 9.0.19.200 Control-M Documentation - Control-M - BMC Documentation 

          Especially look at the sections "Control-M system variables", "String Expressions" and "Variable functions" (there is a function that lets you make date calculations (e.g. today's date -1)).

           

          Regards,

          Bentze

          2 of 2 people found this helpful
          • 2. Re: File_watcher_Job - FileName
            Marouen Kahia

            Thanks, it works!

            Regarding the path file, need to replace 'space' character. So I used '?' but it doesn't work. Did you have an idea?

            • 3. Re: File_watcher_Job - FileName
              Bentze Perlmutter

              You're welcome.

              If I'm not mistaken the wild cards of * and ? can only be used in the file name and not the path.

              But, I thought Control-M will automatically put double-quotes around the path so that should handle spaces.

              If you find it doesn't, you can try to use %%BLANK1 which should resolve to 1 blank. (you can use %%BLANK2 for two blanks and up to 214)

               

              Example:

              Path/File to Watch: C:\My%%BLANK1.Files\prlv_%%$ODATE.*

              Should resolve to: C:\My Files\prlv_20200710*

               

              Regards,

              Bentze