×
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.
* Procedure interface
D GetLilian pi 10i 0
D iDate d Const DatFmt(*ISO)
D wDate s 10a
D wLilian s 10i 0
* Procedure Code
C Eval wDate = DateToChar(iDate : '*ISO')
* Call the ILE API to convert a date into its Lilian representation...
C CallP CeeDAYS(wDate :
C 'YYYY-MM-DD' :
C wLilian :
C Feedback )
* If any errors detected then return -1...
C If fbkSeverity > 0
C Return -1
C Endif
* Return the lilian date...
C Return wLilian
P GetLilian e
The prototypes, etc needed are:
*-----------------------------------------------------
* Convert Date to Lilian Format
*-----------------------------------------------------
D CeeDAYS pr OpDesc
D aDate 32767a Const Options(*VarSize)
D aPicture 32767a Const Options(*VarSize)
D aLilian 10i 0
D aFeedBack Like(FeedBack) Options(*Omit)
D/IF NOT DEFINED(CEE_FEEDBACK)
D/DEFINE CEE_FEEDBACK
D Feedback DS
D fbkSeverity 5i 0
D fbkMsgNo 5i 0
D fbkMsgNo 5i 0
D fbkFlags 1a
D fbkFacID 3a
D fbkIsi 10i 0
D/ENDIF
*-----------------------------------------------------
* Calculate Day of Week from Lilian Date API
*-----------------------------------------------------
D CeeDYWK pr OpDesc
D aLilian 10i 0 Const
D aDayID 10i 0
D aFeedBack Like(FeedBack) Options(*Omit)
D Sunday c Const(1)
D Monday c Const(2)
D Tuesday c Const(3)
D Wednesday c Const(4)
D Thursday c Const(5)
D Friday c Const(6)
D Saturday c Const(7)
*-----------------------------------------------------
* Get Lilian Value for Date
*-----------------------------------------------------
D GetLilian pr 10i 0
D iDate d Const DatFmt(*ISO)
*-----------------------------------------------------
* Get Day of Week
*-----------------------------------------------------
D GetDay pr 1s 0
D iDate d Const DatFmt(*ISO)
If your program identifies the current day of the week then it's fairly
simple maths to calculate the date for the next Tuesday, Wednesday or
Thursday.
Hope it helps
Jonathan
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: 29 September 2010 14:05
To: Midrange Systems Technical Discussion
Subject: Get next Tuesday. Or the one after
Hi all,
I have a 3 jobs J1, J2 and J3 that will run every two weeks on Tuesday,
Wednesday and Thursday respectively.
I want to know what will be the next planned date of the job. Eg, today is
the 29th, J3 will run either tomorrow or the 6th October.
If I set a reference date as the first Tuesday of this year, ie, the 5th of
January, can I get my job date from any given date?
I was thinking of setting the 5th of January as week 1, so to find my date
for the next J1, I would calculate the number of weeks between the 5th of
January and today, divide by 2 to see if it's this week or next week and get
the next Tuesday.
Am I making any sense? Would SQL or RPG be the best tool?
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.