× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi everyone
We are on V7r3
I am trying to determine the first business day of the following month
I have a simple program to start of with It takes a date, calculates the first of the following month, and then finds the day of the week (ISO)
The code is below (like I said - its simple)
Using debug, I can see that HldDayOfWeek_ISO from DayOfWeek_ISO(Beginning_of_Next_Month) is zero (which is NOT a correct value)
But HldDayOfWeek_ISO2 from DAYOFWEEK_ISO(CURRENT_DATE) is 3 - which is correct - today being Wednesday
***NOTE*** - The value of Beginning_Of_Next_month is '2019-02-01' , according to debug
Can anyone see what is wrong with this code?
Why I am not getting the DAYOFWEEK_ISO for Beginning_Of_Next_Month?
As always, all answers replies gratefully accepted

dcl-s MyDate date inz(d'2019-01-02');
dcl-s Beginning_of_Next_Month date;
dcl-s HldDayOfWeek_ISO zoned(2:0);
dcl-s HldDayOfWeek_ISO2 zoned(2:0);

//-------------------------------------------------------------------
// Stand Alone Fields - BOTTOM
//-------------------------------------------------------------------
exec Sql Set Option Commit=*NC, CLOSQLCSR=*ENDMOD, DECMPT=*PERIOD;
exec Sql Set Option DATFMT = *ISO, NAMING = *SQL;

Beginning_of_Next_Month = MyDate - %Days(%subdt( myDate:*days)-1) +
%months(1) ;
exec sql
select DayOfWeek_ISO(Beginning_of_Next_Month)
into :HldDayOfWeek_ISO
FROM SYSIBM.SYSDUMMY1;

exec sql
SELECT DAYOFWEEK_ISO(CURRENT_DATE)
INTO :HldDayOfWeek_ISO2 FROM SYSIBM.SYSDUMMY1;

*inlr = '1';
return;

Alan Shore
E-mail : ASHORE@xxxxxxxx<mailto:ASHORE@xxxxxxxx>
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.