email body format in steps

A lot of scripts ans example to extract information from Control-M tools.
Post Reply
User avatar
vnaresh
Nouveau
Nouveau
Posts: 6
Joined: 29 Nov 2012 12:00

email body format in steps

Post by vnaresh » 15 Jan 2013 11:15

Hi all,

I need to get a notification mail body in the format given below

Sat Jan 12 03:36:00 2013 US PT


I tried to get form the auto edit variables but failed to achieve as they are giving the day and month values in numbers.

can any on e suggest the solution for this.

Thanks in advance.





Naresh

User avatar
mauriziog
Nouveau
Nouveau
Posts: 807
Joined: 08 Jun 2007 12:00
Location: Varese - Italy
Contact:

Post by mauriziog » 25 Jan 2013 12:14

Use the system variables:

%%$DATE AND %%TIME

The best if you check the documentation about autoedit variables, there you find the system variables list, examples and how define user variables.

See also documentation to the e-mail body filed, chars allowed, spaces, variables, etc.

Regards
Last edited by mauriziog on 08 Feb 2013 12:05, edited 1 time in total.

User avatar
vnaresh
Nouveau
Nouveau
Posts: 6
Joined: 29 Nov 2012 12:00

Post by vnaresh » 31 Jan 2013 7:25

Hi mauriziog


Both these variables are returning values in Number Format But in my requirement I them in String Format.

Is there a way to convert them in to String format.


Thanks

User avatar
markf
Nouveau
Nouveau
Posts: 134
Joined: 13 Jul 2006 12:00
Location: Switzerland
Contact:

Post by markf » 31 Jan 2013 6:01

There is pobably a 'cleverer' way to do (and if BMC are reading then it would nice if they could expand the range of system defined variables provided by the Control-M Server) but I do the following -

Just after midnight I run a shell script (my Control-M server is Unix-based) and I set up a load of 'user-friendly' variables based on the Control-M system variables. I have many different variables that I create but here is one part of the script that sets up short monthly names -

set `ctmstvar 0 "%%MONTH"`;
if [ "$1" = "01" ]
then V2=Jan;
elif [ "$1" = "02" ]
then V2=Feb;
elif [ "$1" = "03" ]
then V2=Mar;
elif [ "$1" = "04" ]
then V2=Apr;
elif [ "$1" = "05" ]
then V2=May;
elif [ "$1" = "06" ]
then V2=Jun;
elif [ "$1" = "07" ]
then V2=Jul;
elif [ "$1" = "08" ]
then V2=Aug;
elif [ "$1" = "09" ]
then V2=Sep;
elif [ "$1" = "10" ]
then V2=Oct;
elif [ "$1" = "11" ]
then V2=Nov;
else V2=Dec;
fi;
ctmvar -action set -var "%%#\shortmonthis" -varexpr $V2 -quiet

... so on the back of this I create a variable called %%shortmonthis and today resolves to Jan and tomorrow it should resolve to Feb.

I know that somewhere on this forum somebody posted a method of doing this purely from the command line (within a Control-M job) and it was a very elegant (and efficient) way of doing things. Unfortunately it was a French language version and I never got round to putting it into English, hence my method as shown above.

Post Reply