1

I'm using ControlM and in a command, I would like to find a variable that gives me the date in this format : YYYYMM

I found there is %%$DATE variable but it gives YYYYMMDD

Thanks for you help

Guillaume C
  • 11
  • 1
  • 4

3 Answers3

3

It is possible to define and concatenate a variable that will represent the date in such a format.

These are available:

  • Day DD, %%DAY,
  • Month MM, %%MONTH,
  • Year YY, %%YEAR,
  • Year YYYY, %%$YEAR
Monzurul Shimul
  • 8,132
  • 2
  • 28
  • 42
  • 2
    In order to have two variables next to each other without white space you need to terminate the first with a period. For example “%%$YEAR.%%MONTH” should achieve your goal. – Jasper Apr 17 '20 at 18:53
  • Furthermore, you can keep your "customized" dates (built in the way described) in the LIBMEMSYM (or LIBMEMSYMs).. – Mark Apr 18 '20 at 17:49
2

Prefer %%$OYEAR AND %%OMONTH over %%$YEAR and %%MONTH

I suggest using the variables %%$OYEAR and %%OMONTH over %%$YEAR and %%MONTH. The reason is that date variables beginning with O refer to processing dates and do not necessarily coincide with the system date. For this case you could use any of the following options:

 1. YYYYMM = %%$OYEAR.%%OMONTH 
 2. YYYYMM = %%SUBSTRING %%$ODATE 1 6

The $ symbol preceding the variable %%$OYEAR or %%$ODATE indicates that the year is returned in 4-digit format, instead of OYEAR or ODATE which print the year with only 2 digits.

The dot (.) character is used for concatenate variables.

For example: For the order day May 29, 2020.

 1. %%$ODATE would print 20200529 
 2. %%ODATE would print  200529
racherb
  • 335
  • 1
  • 10
0

You should add dot in each end of paramter

YYYY = %%$OYEAR.
MM = %%OMONTH.
YYYYMM = %%$OYEAR.%%OMONTH.
AnthonyLu
  • 23
  • 5
  • Please describe what the dot does, and preferably, link to the documentation. Also, check your spelling before posting an answer. – Gogowitsch Jun 11 '23 at 12:13