Global Variable to calculate Last Day of the current month
Global Variable to calculate Last Day of the current month
How can I create a global variable to calculate the last day of the current month ?
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 ) :
%%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.
But if you want to use variable, first create un file (LIBSYSMEN)
the idea or logic is(may be needed some adjust ) :
%%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.
- claudio960
- Nouveau
- Posts: 3
- Joined: 18 Sep 2006 12:00
I think this program fails in December and take care with the variable names.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 ) :
%%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.
Regards
Claudio