Wednesday, October 3, 2012

AutoEdit variables (Date and Time)


Few examples:
Below %%BB is resolved to 5PM on current system date
%%AA= %%$CALCDATE %%$DATE
%%BB= %%AA.1700

Below %%BB is resolved to 6:40 AM on next day of current system date
%%AA= %%$CALCDATE %%$ODATE +1
%%BB= %%AA.0640

AutoEdit functions
%%CALCDATEAdds or subtracts a specified number of days from a specified date.

On October 1, 2012, %%A resolves to 120930 in any of the following expressions:

%%A=%%CALCDATE %%DATE -1
%%A=%%CALCDATE 121001 -%%DAY
%%A=%%CALCDATE 120929 +1

%%$CALCDATESame as %%CALCDATE, but handles 4-digit years.

On October 1, 2012, %%A resolves to 20120930 in any of the following expressions:
%%A=%%$CALCDATE %%$DATE -1
%%A=%%$CALCDATE 20121001 -%%DAY
%%A=%%$CALCDATE 20120929 +1

%%SUBSTRExtracts a substring from a specified string.

Syntax:
%%SUBSTR variable start_position length

In the following series of expressions, %%Number resolves to TWO:
%%Nstring=ONETWOTHREE
%%Start=4
%%Number=%%SUBSTR %%Nstring %%Start 3

An example for Date & time.
%%HH %%SUBSTR %%TIME 1 2
%%MM %%SUBSTR %%TIME 3 2
%%SS %%SUBSTR %%TIME 5 2
%%PARM1 %%$OYEAR:%%OMONTH:%%ODAY%%BLANK1.%%HH..%%MM..%%SS
result is : 2012:10:01 10.58.02

Few important Control-M variables


4 comments:

  1. hello Manju,

    Thank you for the blog on controlM

    I have been searching for some thing of this kind since 2 years..

    I have a question on date value as below
    need "JAN2015" at folder level variable and use the same across the jobs,

    can you explain the logic for the same?


    ReplyDelete
  2. Can you able to get "JAN2015". I have a similar requirement where I need to move folders named "Jan2017" , "Feb2017" etc until "Dec2017" into a different folder through Control-M. I need to dynamically generate this "Jan2017" etc. Please let me know if you have a soluion

    ReplyDelete
  3. Hey Shruthi,
    Sorry for the delay. I'm not a regular blogger.
    If you're still have the above concern, below answer can help.

    Control-M variables doesn't work with letters (in this case).

    So you may need to specify variables like below.

    %%A01=JAN
    %%A02=FEB
    .
    .
    %%A12=DEC

    %%AMON=%%M%%MONTH
    %%A=%%AMON.%%$YEAR

    Then the %%A will resolve to current month and year as NOV2017.

    Hope this helps.

    Let me know if you have any other concerns.

    ReplyDelete
  4. Nice work. YOu can post more pages in the same blog . Your experience will add a lot of value and bring some nice things in to the table .

    Keep it up and All the best

    ReplyDelete