Global Variable to calculate Last Day of the current month

All questions about Control-M jobs definitions
Post Reply
User avatar
aazizi
Nouveau
Nouveau
Posts: 2
Joined: 14 Jun 2010 12:00

Global Variable to calculate Last Day of the current month

Post by aazizi » 07 Aug 2011 12:11

How can I create a global variable to calculate the last day of the current month ?

User avatar
abonilla
Nouveau
Nouveau
Posts: 5
Joined: 27 Jul 2011 12:00
Location: Panama

Post by abonilla » 09 Aug 2011 10:58

ok, the easy way is using a calendar then apply L1 to execute only the last day of the month.

But if you want to use variable, first create un file (LIBSYSMEN)
the idea or logic is(may be needed some adjust :-P) :
%%today=%%$ODATE
%%currentMonth=%%SUBSTR %%today 5 2
%%currentDay=%%SUBSTR %%today 7 2
%%currentYear=%%SUBSTR %%today 1 4
%%nextMont=%%currentMonth %%PLUS 1
%%NextFirstDay=%%currentYear.%%nextMonth.01
%%lastDayMonth=%%CALCDATE %%NextFirstDay -1

the var %%lastDayMonth has the value of the last day of the current month.

remember :
%%ODATE: Year 2 digits
%%$DATE: Year 4 digit

it's applies for all variable date format.

User avatar
claudio960
Nouveau
Nouveau
Posts: 3
Joined: 18 Sep 2006 12:00

Post by claudio960 » 12 Aug 2011 4:51

abonilla wrote:ok, the easy way is using a calendar then apply L1 to execute only the last day of the month.

But if you want to use variable, first create un file (LIBSYSMEN)
the idea or logic is(may be needed some adjust :-P) :
%%today=%%$ODATE
%%currentMonth=%%SUBSTR %%today 5 2
%%currentDay=%%SUBSTR %%today 7 2
%%currentYear=%%SUBSTR %%today 1 4
%%nextMont=%%currentMonth %%PLUS 1
%%NextFirstDay=%%currentYear.%%nextMonth.01
%%lastDayMonth=%%CALCDATE %%NextFirstDay -1

the var %%lastDayMonth has the value of the last day of the current month.

remember :
%%ODATE: Year 2 digits
%%$DATE: Year 4 digit

it's applies for all variable date format.
I think this program fails in December and take care with the variable names.

:)

Regards

Claudio

User avatar
fabiana
Nouveau
Nouveau
Posts: 7
Joined: 22 Jun 2009 12:00
Location: Rio de Janeiro

Post by fabiana » 12 Aug 2011 5:44

I only use the L1 .. I find it easier and safer
hugs

Post Reply