[U2] Fw: Seminar in Cincinnati on June 23rd for the UniData and UniVerse database users

2005-06-02 Thread rlsmith
Has anyone else hear about this and is going? Greetings! I hope this invitation is reaching the people in your organization responsible for the IBM UniData or UniVerse database technology that you are using in your company. If not please advise and I will resend, or just forward to that

[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

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 convert

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

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 fragment to achieve

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 think

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 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

RE: [U2] Finding last day of month

2005-06-02 Thread Perry Taylor
Here's how I do it... JJ = ICONV(THE.DATE, 'D') MO = OCONV(JJ, 'DM') YR= OCONV(JJ, 'DY') DAY=28 LOOP TRY = OCONV(ICONV(MO:'/':DAY+1:'/':YR, 'D'), 'DM') WHILE TRY = MO DO REPEAT LAST.DAY = MO:'/':DAY:'/':YR Perry Taylor -Original Message- From: Marco Manyevere [mailto:[EMAIL

RE: [U2] Finding last day of month

2005-06-02 Thread gerry-u2ug
same idea with a few less conversions cdate=20040203 yr=cdate[1,4] mn=cdate[5,2] if mn12 then mn+=1 else mn=1 ; yr+=1 edate=oconv(iconv(mn'R%2':'-01-':yr,D)-1,D) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Marco

RE: [U2] Finding last day of month

2005-06-02 Thread Kathleené M Bodine
0001: INPUT DATE 0002: USE.DATE = ICONV(DATE,D) 0003: MTH = OCONV(USE.DATE,DM) 0004: YR = OCONV(USE.DATE,DY4) 0005: IF MTH LT 12 THEN 0006: MTH += 1 0007: END ELSE 0008: MTH = 1 0009: YR += 1 0010: END 0011: NEW.DATE = ICONV(MTH:/01/:YR,D) - 1 0012: CRT OCONV(NEW.DATE,D) -Original

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
I've always used the simple method. *Initialization section END.DATES = '31,28,31,30,31,30,31,31,30,31,30,31' END.DATES = CHANGE(END.DATES,',',@AM) *Main loop section LAST.DATE = END.DATESMONTH IF MONTH = 2 AND NOT(MOD(YEAR,4)) THEN LAST.DATE+=1 btw, there may be an error in this, my allergies

RE: [U2] Finding last day of month

2005-06-02 Thread Ian McGowan
Need to take month mod 12, when adding... D=20040203 Y=D[1,4] M=D[5,2] M+=1 IF M12 THEN M=1;Y+=1 NEXT.M=ICONV(M:/01/:Y,D4/)-1 PRINT OCONV(NEXT.M,D4Y):OCONV(NEXT.M,DM):OCONV(NEXT.M,DD) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere

RE: [U2] Finding last day of month

2005-06-02 Thread Paul Sohn
I believe you need to add a month check for December using that method: IN.DATE='20040203' NEW. = IN.DATE[1,4] NEW.MM = (IN.DATE[5,2]+1) 'R%2' IF NEW.MM=13 THEN NEW.MM='01' NEW.+=1 END I.LAST.DAY = ICONV(NEW.MM:-01-:NEW.),D4-)-1 -Original Message- From: [EMAIL

RE: [U2] Finding last day of month

2005-06-02 Thread Norman Morgan
Won't this method choke if ORIG.MM is 12? === Norman Morgan [EMAIL PROTECTED] http://www.brake.com === Unscrewing an Oreo lets all the calories out.

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

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 Richard A. Wilson
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 exception is that years divisible by 400 are leap years of course

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
Wow, when did they sneak that in? And you forgot the {current weather condition} in Calgary ;-) Allen in the foggy San Fernando Valley -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Thursday, June 02, 2005 12:22 PM To:

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 for a

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 EDAY = EDATESEMONTH

RE: [U2] Finding last day of month

2005-06-02 Thread Ed Clark
Wow, there is a LAST_DAY function in unidate. I have 6.0 on HPUX and it works in virtual attributes but not in a basic program. Is that documented anywhere? What other cool functions are there undocumented? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
So...it won't be a problem until 2,400? I can live with that. And 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:

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,

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 [snip]

Re: [U2] Finding last day of month

2005-06-02 Thread Richard A. Wilson
2100 2300 aren't leap years. I guess it depends on the application, antiques, historical dates etc. or future dates like when you will be fully vested in your retirement acct. g Rich Allen E. Elwood wrote: So...it won't be a problem until 2,400? I can live with that. And I'm gettin' up

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
Mongo only small pawn in game of leap years I'm sure by then all of my code will be obsolete and that the technology that replaces computers will be beyond anything I can even imagine I read somewhere that some smart guy figured out how to transport a photon and one of the possible

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. If

RE: [U2] Finding last day of month

2005-06-02 Thread Marilyn Hilb
Program that! Works with one hand too. Just hit the last knuckle a 2nd time before heading back. Easier to have 1 hand for pointing, pencil in the mouth to point marks up my hands. I was also taught this someplace along the line, and still use this method to this day. -Original

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

[U2] Herve Balestrieri/France/IBM est absent ce jour 03/06/2005. In english : is out of office today Friday June 3rd, 2005.

2005-06-02 Thread Herve Balestrieri
I will be out of the office starting 03/06/2005 and will not return until 06/06/2005. Pour les clients accidant au Support Technique des produits IBM U2, veuillez renvoyer votre message sur : [EMAIL PROTECTED] Merci For non-french speaking customers : If your IBM U2 products Technical

RE: [U2] Finding last day of month

2005-06-02 Thread Ross Morrissey
Aiming for SHORT (not clean, clear, or any of that other good stuff): PRINT D: ; INPUT D PRINT D[1,6]:MOD(D[5,2]+D[5,2]7,2)+30-(D[5,2]=2)*(2-MOD(D[1,4],4)#0) D?20040203 20040229 D?20030303 20030331 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco

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 FFT2001
soapbox 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! /soapbox Will Johnson --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit

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
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 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 =

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,

RE: [U2] Finding last day of month

2005-06-02 Thread Allen E. Elwood
Gee guys, mine was 4 lines. I think the request was for the 'shortest'... :-) Now, who's gonna put all these routines through a speed test to find out which is the most efficient? Me, I'm going back to watching Kull the conqueror -Original Message- From: [EMAIL PROTECTED]

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 will

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 ;) 1