×
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.
Here is a example for this specific request.
* Input date format is Alphanumeric - MM/DD/YY (include the '/')
D Get_NxtDay PR
D p_Date_Parm 8 const
D Get_NxtDay PI
D p_Date_Parm 8 const
* work fields for date conversion
D w_Work_Date S D datfmt(*USA)
D w_Dsply_Date S D datfmt(*USA)
D w_Response S 1 inz
* constants for day(s) of week
D c_Sunday C const(1)
D c_Monday C const(2)
D c_Tuesday C const(3)
D c_Wednesday C const(4)
D c_Thursday C const(5)
D c_Friday C const(6)
D c_Saturday C const(7)
D Get_Date_For_Next_Occurance_Of_Week_Day...
D PR D
D p_Input_Date D const
D datfmt(*USA)
D p_Target_Day_Of_Week...
D 10i 0 const
/free
If %parms > *ZERO ;
// Move the input parameter value to a DATE field
w_Work_Date = %date(p_Date_Parm:*MDY) ;
// Now add days to advance date
w_Work_Date += %days(45) ;
Dsply ('Date + 45 days = ' + %char(w_Work_Date)) ;
// Now set date to selected Target day(s) of week
w_Dsply_Date = Get_Date_For_Next_Occurance_Of_Week_Day
( w_Work_Date :
c_Sunday ) ;
Dsply ('Target Date Sunday = ' + %char(w_Dsply_Date)) ;
w_Dsply_Date = Get_Date_For_Next_Occurance_Of_Week_Day
( w_Work_Date :
c_Monday ) ;
Dsply ('Target Date Monday = ' + %char(w_Dsply_Date)) ;
w_Dsply_Date = Get_Date_For_Next_Occurance_Of_Week_Day
( w_Work_Date :
c_Tuesday ) ;
Dsply ('Target Date Tuesday = ' + %char(w_Dsply_Date)) ;
w_Dsply_Date = Get_Date_For_Next_Occurance_Of_Week_Day
( w_Work_Date :
c_Wednesday ) ;
Dsply ('Target Date Wednesday = ' + %char(w_Dsply_Date)) ;
w_Dsply_Date = Get_Date_For_Next_Occurance_Of_Week_Day
( w_Work_Date :
c_Thursday ) ;
Dsply ('Target Date Thursday = ' + %char(w_Dsply_Date)) ;
w_Dsply_Date = Get_Date_For_Next_Occurance_Of_Week_Day
( w_Work_Date :
c_Friday ) ;
Dsply ('Target Date Friday = ' + %char(w_Dsply_Date)) ;
w_Dsply_Date = Get_Date_For_Next_Occurance_Of_Week_Day
( w_Work_Date :
c_Saturday ) ;
Dsply ('Target Date Saturday = ' + %char(w_Dsply_Date))
' ' w_Response ;
else ;
Dsply 'Date Not Entered - Enter MM/DD/YY' ' ' w_Response ;
endIf ;
*INLR = *ON ;
return ;
/end-free
*------------------------------------------------------------------------
* Advance Date to Next Occurance of the Selected Day of the Week
*------------------------------------------------------------------------
P Get_Date_For_Next_Occurance_Of_Week_Day...
P B
D Get_Date_For_Next_Occurance_Of_Week_Day...
D PI D
D p_Input_Date D const
D datfmt(*USA)
D p_Target_Day_Of_Week...
D 10i 0 const
* work fields for date conversion
D w_Lillian_Date S 10I 0 inz
D w_Day_of_Week S 10I 0 inz
D w_Feed_Back_Code...
D S 12 inz
D w_Target_Date S D datfmt(*USA)
* Prototypes for CEE Date Conversion Procedures
DGet_Lillian_Date...
D PR extproc('CEEDAYS') OpDesc
D p_Char_Date 10 const
D options(*varsize)
D p_Date_Picture...
D 10 const
D options(*varsize)
D p_Lillian_Date...
D 10I 0
D p_Feed_Back_Code...
D 12 options(*NOPASS)
DGet_Day_Of_Week...
D PR extproc('CEEDYWK') OpDesc
D p_Lillian_Date...
D 10I 0 const
D p_Day_Of_Week...
D 10I 0
D p_Feed_Back_Code...
D 12 options(*NOPASS)
/free
callp Get_Lillian_Date
( %char(p_Input_Date):
'MM/DD/YYYY' :
w_Lillian_Date :
w_Feed_Back_Code ) ;
callp Get_Day_Of_Week
( w_Lillian_Date :
w_Day_Of_Week :
w_Feed_Back_Code ) ;
If p_Target_Day_Of_Week = w_Day_Of_Week ;
// With this code if the Target Day of Week is same day of the
week
// as the input date - the Input date is returned
w_Target_Date = p_Input_Date ;
// If you want the date to be the True NEXT Occurance of the
Target Day
// execute the following instead of the line above
// w_Target_Date = p_Input_Date + %days(7) ;
elseIf p_Target_Day_Of_Week > w_Day_Of_Week ;
w_Target_Date = p_Input_Date
+ %days(p_Target_Day_of_Week - w_Day_Of_Week) ;
else ;
w_Target_Date = p_Input_Date
+ %days( (7 - w_Day_Of_Week) +
p_Target_Day_Of_Week );
endIf ;
return w_Target_Date ;
/end-free
P E
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.