Page 1 of 1

email body format in steps

Posted: 15 Jan 2013 11:15
by vnaresh
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

Posted: 25 Jan 2013 12:14
by mauriziog
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

Posted: 31 Jan 2013 7:25
by vnaresh
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

Posted: 31 Jan 2013 6:01
by markf
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.