RE: [U2] Finding last day of month

2005-06-07 Thread Mark Baldridge
I wrote the application about 15 years ago when we were then VMark Software. I believe that would make it an internal IBM tool. I have several other performance measuring tools that I use at customer sites when analyzing system, application, and other performance issues. The set of tests are lik

RE: [U2] Finding last day of month

2005-06-06 Thread Stevenson, Charles
Mark, What are these timing tests? They kinda look like the tool PI has. I can almost remember the name of it now, but it was so long ago. Is this a tool we users can run or is this something internal at IBM? If internal, do you have a complete set of comparative speeds for the various operations

Re: [U2] Finding last day of month

2005-06-04 Thread Mark Baldridge
The original request was for a shortest code fragment. This likely meant as line count, but could have been execution time. I am using UniVerse 10.1.3 on a 1.7 GHz pentium. Here are some current timings. Except for test 0001 which is an empty FOR NEXT loop, to the left of the "|" is a hint of t

RE: [U2] Finding last day of month

2005-06-03 Thread Bob Witney
users@listserver.u2ug.org Cc: Subject: Re: [U2] Finding last day of month Will, This was exactly my method, except I was adding 35 days (it could have been 30 as well) to the first day of the month to get to next month. I

Re: [U2] Finding last day of month

2005-06-03 Thread Moderator
All, The "Play Date" has been moved to the U2-Community. - Charles Barouch, Moderator To sign up for U2-Community or any of our other lists: 1. U2-Users 2. U2-Community 3. RBSolutions 4. SBSolutions 5. U2-Users Digest 6. U2-Community Digest 7. RBSolutions Digest 8

Re: [U2] Finding last day of month

2005-06-03 Thread Marco Manyevere
Will, This was exactly my method, except I was adding 35 days (it could have been 30 as well) to the first day of the month to get to next month. I also dislike the lookup table idea i.e. 31,28,30,31,etc, the leap year or 12th month logic. Thanks for all the responses guys. [EMAIL PROTECT

Re: [U2] Finding last day of month

2005-06-03 Thread Stuart . Boydell
> But your's takes more CPU cycles so there :) > Smaller in opcode? or smaller in milliseconds? > Ah Yeah, but now that you've challenged me, this one's smaller in size, op codes and presumably cpu. input oDate ; *format mmdd lastDayOfMonth = oconv(iconv(oconv(iconv(oDate,'ml#6':@

Re: [U2] Finding last day of month

2005-06-02 Thread FFT2001
In a message dated 6/2/2005 8:17:25 PM Pacific Daylight Time, [EMAIL PROTECTED] writes: > That's an interesting approach, but it comes at the price of an extra > ICONV, which is more expensive than a simple IF statement. Granted, the > difference isn't significant for a small number of invoca

Re: [U2] Finding last day of month

2005-06-02 Thread FFT2001
In a message dated 6/2/2005 9:40:08 PM Pacific Daylight Time, [EMAIL PROTECTED] writes: > [EMAIL PROTECTED] wrote on 06/02/2005 10:34:09 PM: > > > input oDate ; *format mmdd > > iDate = iconv(oDate,'dymd') > > loop until oconv(iDate+1,'dd) = 1 do iDate += 1 repeat > > lastDay = oconv(iDate

RE: [U2] Finding last day of month

2005-06-02 Thread Anthony Grant
Oh please, Kieran. That's overboard. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kieran Clulow Sent: Friday, 3 June 2005 11:43 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Finding last day of month ... or as a one line coding horror

Re: [U2] Finding last day of month

2005-06-02 Thread Timothy Snyder
[EMAIL PROTECTED] wrote on 06/02/2005 10:34:09 PM: > input oDate ; *format mmdd > iDate = iconv(oDate,'dymd') > loop until oconv(iDate+1,'dd) = 1 do iDate += 1 repeat > lastDay = oconv(iDate,'dymd') > > Not sure if it's worth bragging about - but mine's smaller (146 v. 161 > bytes). This w

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
L PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Thursday, June 02, 2005 7:46 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Finding last day of month In a message dated 6/2/05 7:07:42 PM Pacific Daylight Time, [EMAIL PROTECTED] writes: << Inpu

Re: [U2] Finding last day of month

2005-06-02 Thread Timothy Snyder
[EMAIL PROTECTED] wrote on 06/02/2005 09:54:59 PM: > Input Date ; *format mmdd > NextMonth = Oconv(Iconv(date[1,6]:'15','D') + 30,'D2') > I.LastDayPreviousMonth = Iconv(NextMonth[1,2]:'01':NextMonth[5,2],'D') + 1 That's an interesting approach, but it comes at the price of an extra ICONV, w

Re: [U2] Finding last day of month

2005-06-02 Thread FFT2001
In a message dated 6/2/05 7:07:42 PM Pacific Daylight Time, [EMAIL PROTECTED] writes: << Input Date ; * format mmdd Middleofthismonth = date[1,6]:'15' I.Middle = Iconv(Middleofthismonth,'D') I.Next = I.Middle + 30 NextMonth = Oconv(I.NEXT,'D2-') FirstDayNextMonth = NextMonth[1,2]:'01':Ne

Re: [U2] Finding last day of month

2005-06-02 Thread Stuart . Boydell
[EMAIL PROTECTED] wrote on 03-06-2005 12.54.59: > > Now can we scrunch this down? > Input Date ; *format mmdd > NextMonth = Oconv(Iconv(date[1,6]:'15','D') + 30,'D2') > I.LastDayPreviousMonth = Iconv(NextMonth[1,2]:'01':NextMonth[5,2],'D') + 1 input oDate ; *format mmdd iDate = iconv(oD

Re: [U2] Finding last day of month

2005-06-02 Thread FFT2001
Ok smartass you say let's see you do it First of all, you can always get from the month you are in, to the next month by simply add 30 days to the middle of the month. And you never need to worry about leap years nor about 12th month logic Input Date ; * format mmdd Middleofthismonth

RE: [U2] Finding last day of month

2005-06-02 Thread Kieran Clulow
... or as a one line coding horror ;) 1 LAST.DAY = REPLACE(CHANGE('31,28,31,30,31,30,31,31,30,31,30,31',',',@AM),2;28+(NOT(MOD(( THISDATE[1,4]),4)) AND (NOT(MOD((THISDATE[1,4]),400)) OR MOD((THISDATE[1,4]),100<(THISDATE[5,2]+0)> --- u2-users mailing list u2-users@listserver.u2ug.org

Re: [U2] Finding last day of month

2005-06-02 Thread FFT2001
People! use the system why are you doing all this math in your program? The system knows what years are leap and what aren't. Let it do the work for you! Will Johnson --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/

Re: [U2] Finding last day of month

2005-06-02 Thread FFT2001
Add of you who are doing special logic on month 12 are FIRED! Will Johnson Fast Forward Technologies --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/

RE: [U2] Finding last day of month

2005-06-02 Thread Kieran Clulow
That incorrectly thinks 2100 is a leap. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ross Morrissey Sent: Friday, 3 June 2005 10:15 AM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Finding last day of month Aiming for SHORT (not clean, clear, or

RE: [U2] Finding last day of month

2005-06-02 Thread Kieran Clulow
YEAR = THISDATE[1,4] ; MONTH = THISDATE[5,2]+0 DAYS = CHANGE('31,28,31,30,31,30,31,31,30,31,30,31',',',@AM) DAYS<2> += (NOT(MOD(YEAR,4)) AND (NOT(MOD(YEAR,400)) OR MOD(YEAR,100))) LAST.DATE = DAYS Should catch everything. Kieran. --- u2-users mailing list u2-users@listserver.u2ug.org To uns

RE: [U2] Finding last day of month

2005-06-02 Thread Ross Morrissey
On Behalf Of Marco Manyevere Sent: Thursday, June 02, 2005 10:31 AM To: u2-users@listserver.u2ug.org Subject: [U2] Finding last day of month Given a date like 20040203, I want to return the last valid date for that month and year (20040229 in this case). What is the shortest code fragment to

RE: [U2] Finding last day of month

2005-06-02 Thread Bruce Nichol
Oh dear, Oh dear! What ever happend to : DATE = '' FOR I = 31 TO 28 STEP -1 IF OCONV(ICONV(I:rest of date,'D'),'D') = I:rest of date THEN DATE = I:rest of date EXIT END NEXT I IF DATE = '' THEN Come to screeching HALT Of course for the people with backward dates (!!!), the "I:rest of

RE: [U2] Finding last day of month

2005-06-02 Thread Marilyn Hilb
Message- From: Stevenson, Charles [mailto:[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 4:02 PM To: u2-users@listserver.u2ug.org Subject:RE: [U2] Finding last day of month I use the method my dad taught me when I was a kid, cuz I couldn't remember "Thiry days hath

RE: [U2] Finding last day of month

2005-06-02 Thread Stevenson, Charles
I use the method my dad taught me when I was a kid, cuz I couldn't remember "Thiry days hath September...". Hold 2 fists side-by-side, forefingers of right & left hand touching. Each knuckle and each valley between knuckles represents a month. Start at the left pinky knuckle and count off months.

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
sible applications will be a zero wait state memory device. Beam me up Scotty! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Richard A. Wilson Sent: Thursday, June 02, 2005 1:38 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Finding last day of month

Re: [U2] Finding last day of month

2005-06-02 Thread Richard A. Wilson
I'm gettin' up there in my years too. Just turned 49 last March. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Richard A. Wilson Sent: Thursday, June 02, 2005 12:29 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Finding last day of month y

RE: [U2] Finding last day of month

2005-06-02 Thread James Canale, Jr.
This is documented back to at least UniData 5.2 and probably earlier than that though I don't have easy access to the old manuals. It is in the "Using UniData" manual in the "Creating Virtual Attributes" section. You may wish to search for "Virtual Attribute Functions". HTH. Regards, Jim [s

RE: [U2] Finding last day of month

2005-06-02 Thread colin.alfke
It's in my version 5 documentation - not sure when it was put in. There is also ADD_MONTHS, LAST_DAY, MONTHS_BETWEEN and NEXT_DAY. See Virtual Attribute Functions in chapter 5 Creating Virtual Attributes. Colin Alfke Calgary, Canada Where it's Sunny, no pouring rain, no wait it's just cloudy, oops

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Finding last day of month you cant just use mod(x,4) logic the following from some website (dont remember where/when I found it) *** The rule for leap years is that all years divisable by 4 are leap years, except those years divisable by 100. The ex

RE: [U2] Finding last day of month

2005-06-02 Thread Ed Clark
[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 2:22 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Finding last day of month If it's for a UniData dictionary you can use the function LAST_DAY(date) that will return the last day of the month. I'm not sure if UniVerse has this functi

RE: [U2] Finding last day of month

2005-06-02 Thread Rotella, Leon M.
Here's yet another way... END.OF.MONTH 0001 EDATES = "31":@FM:"29":@FM:"31":@FM:"30":@FM:"31":@FM:"30":@FM:"31":@FM:"31":@FM: "30":@FM:"31 ":@FM:"30":@FM:"31" 0002 PRINT "INPUT DATE MMDD - ": ; INPUT ODATE 0003 EYEAR = ODATE[1,4] 0004 EMONTH = ODATE[5,2] 0005

RE: [U2] Finding last day of month

2005-06-02 Thread Ed Clark
unidata has a LAST_DAY function? what version is that? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Thursday, June 02, 2005 2:22 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] Finding last day of month If it's

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
: u2-users@listserver.u2ug.org Subject: RE: [U2] Finding last day of month If it's for a UniData dictionary you can use the function LAST_DAY(date) that will return the last day of the month. I'm not sure if UniVerse has this function as well. Eg: 001: I 002: LAST_DAY(INVOICE.DATE) 003:

Re: [U2] Finding last day of month

2005-06-02 Thread Richard A. Wilson
: Thursday, June 02, 2005 11:21 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Finding last day of month That method can actually backfire, for example, if your starting date is 20040130, you'll end up on Feb 29 instead of Jan 31. What I would do is replace the day with 01 and add

RE: [U2] Finding last day of month

2005-06-02 Thread colin.alfke
If it's for a UniData dictionary you can use the function LAST_DAY(date) that will return the last day of the month. I'm not sure if UniVerse has this function as well. Eg: 001: I 002: LAST_DAY(INVOICE.DATE) 003: D4 004: Last Day of Month 005: 15R

Re: [U2] Finding last day of month

2005-06-02 Thread Don Verhagen
* User Supplied ISO Date UserDate= '20040203' UserDateYear= UserDate[1,4] + 0 UserDateMonth = UserDate[5,2] + 0 UserDateDay = UserDate[7,2] + 0 * First Day Of The Next Month NextMonthYear = UserDateYear + (IF (UserDateMonth + 1) > 12 THEN 1 ELSE 0) NextMonthMonth = (IF (UserDat

RE: [U2] Finding last day of month

2005-06-02 Thread Norman Morgan
the calories out. === > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Allen Egerton > Sent: Thursday, June 02, 2005 12:57 PM > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] Finding last day of month &g

RE: [U2] Finding last day of month

2005-06-02 Thread Paul Sohn
quot;)-1 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Allen Egerton Sent: Thursday, June 02, 2005 10:57 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Finding last day of month From: "Marco Manyevere" <[EMAIL PROTECTED]> > Hi, >

RE: [U2] Finding last day of month

2005-06-02 Thread Ian McGowan
gt; From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Marco Manyevere > Sent: Thursday, June 02, 2005 10:31 AM > To: u2-users@listserver.u2ug.org > Subject: [U2] Finding last day of month > > > Hi, > > Given a date like 20040203, I want to return t

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
in this, my allergies are truly messing with my head today.and for the last weekGaaa Allen -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dianne Ackerman Sent: Thursday, June 02, 2005 11:21 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] Finding

RE: [U2] Finding last day of month

2005-06-02 Thread Kathleené M Bodine
:YR,"D") - 1 0012: CRT OCONV(NEW.DATE,"D") -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere Sent: Thursday, June 02, 2005 10:31 AM To: u2-users@listserver.u2ug.org Subject: [U2] Finding last day of month Hi, Given a date like 20040203,

RE: [U2] Finding last day of month

2005-06-02 Thread gerry-u2ug
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Marco Manyevere Sent: Thursday, June 02, 2005 01:31 PM To: u2-users@listserver.u2ug.org Subject: [U2] Finding last day of month Hi, Given a date like 20040203, I want to return the last valid date for that month and year (20040229 in this

RE: [U2] Finding last day of month

2005-06-02 Thread Perry Taylor
27;/':YR Perry Taylor -Original Message- From: Marco Manyevere [mailto:[EMAIL PROTECTED] Sent: Thu Jun 02 14:05:42 2005 To: u2-users@listserver.u2ug.org Subject:[U2] Finding last day of month Hi, Given a date like 20040203, I want to return the last valid date for that mont

Re: [U2] Finding last day of month

2005-06-02 Thread Dianne Ackerman
That method can actually backfire, for example, if your starting date is 20040130, you'll end up on Feb 29 instead of Jan 31. What I would do is replace the day with 01 and add 1 to the month, then iconv and subtract 1 day. -Dianne Marco Manyevere wrote: Hi, Given a date like 20040203, I w

Re: [U2] Finding last day of month

2005-06-02 Thread Cliff Bennett
Hi, Marco. I always ICONV the first day of the next month, then subtract a day. For example: ANY.DATE = '02-03-2004' MO = ANY.DATE[1,2] YR = ANY,DATE[7,4] MO += 1 IF MO > 12 THEN MO = 1 YR += 1 END EOM.DATE = ICONV(MO:'-01-':YR, 'D') - 1 This lends itself to a subroutine or function as

Re: [U2] Finding last day of month

2005-06-02 Thread Timothy Snyder
Marco Manyevere <[EMAIL PROTECTED]> wrote on 06/02/2005 01:31:17 PM: > Given a date like 20040203, I want to return the last valid date for > that month and year (20040229 in this case). What is the shortest > code fragment to achieve this? Ooh! A good old-fashioned programming challenge. I t

RE: [U2] Finding last day of month

2005-06-02 Thread Bob Woodward
I might offer a small modification to your code snippet as noted below. BobW > > From: "Marco Manyevere" <[EMAIL PROTECTED]> > > > > Hi, > > > > Given a date like 20040203, I want to return the last valid date for > that > month and year (20040229 in this case). What is the shortest code fragme

Re: [U2] Finding last day of month

2005-06-02 Thread Lembit Pirn
You can try ICONV(date,code) and check STATUS(). If status() returns other than 0 then date is valid Marco Manyevere wrote: Hi, Given a date like 20040203, I want to return the last valid date for that month and year (20040229 in this case). What is the shortest code fragment to achieve thi

Re: [U2] Finding last day of month

2005-06-02 Thread Allen Egerton
From: "Marco Manyevere" <[EMAIL PROTECTED]> > Hi, > > Given a date like 20040203, I want to return the last valid date for that month and year (20040229 in this case). What is the shortest code fragment to achieve this? Find the internal date of the first day of the next month, subtract 1, and c

[U2] Finding last day of month

2005-06-02 Thread Marco Manyevere
Hi, Given a date like 20040203, I want to return the last valid date for that month and year (20040229 in this case). What is the shortest code fragment to achieve this? At the moment I'm replacing the day with 01, then iconv, add 35 days to the internal date and then oconv and replace the day