Re: [U2] End of Month date routine

2011-12-08 Thread andy baum
Scratch that, should read things more carefully, obviously 2 hours sleep is not enough. Cheers, Andy From: andy baum To: U2 Users List Sent: Thursday, 8 December 2011, 7:52 Subject: Re: [U2] End of Month date routine Stuart, You are getting the

Re: [U2] End of Month date routine

2011-12-07 Thread andy baum
= @false will never be happen as it will already have been picked up by the previous case Cheers, Andy From: "Boydell, Stuart" To: U2 Users List Sent: Thursday, 8 December 2011, 6:44 Subject: Re: [U2] End of Month date routine On UV the vlist woul

Re: [U2] End of Month date routine

2011-12-07 Thread Boydell, Stuart
Sent: Thursday, 8 December 2011 15:02 To: andyb...@yahoo.co.uk; u2-users@listserver.u2ug.org Subject: Re: [U2] End of Month date routine Why couldn't you say LEAP.YEAR = NOT(MOD(YEAR,4)) AND (NOT(MOD(YEAR,400)) OR MOD(YEAR,100)) Would the system process the whole line

Re: [U2] End of Month date routine

2011-12-07 Thread Wjhonson
eers, Andy From: Daniel McGrath To: "dgr...@dagconsulting.com" ; U2 Users List Sent: Wednesday, 7 December 2011, 18:57 Subject: Re: [U2] End of Month date routine I added the code to PasteBin so as to not flood here: http://pastebin.com/JMyqhFud I did a few more than 100K and I cu

Re: [U2] End of Month date routine

2011-12-07 Thread andy baum
el McGrath' ; 'U2 Users List' Sent: Wednesday, 7 December 2011, 20:23 Subject: Re: [U2] End of Month date routine Okay I took the fastest routine and made it into an $INSERT piece of code: YEAR = OCONV(THE.DATE, "DY") IF MOD(YEAR,4) THEN   LEAP.YEAR = 0 END ELSE   IF

Re: [U2] End of Month date routine

2011-12-07 Thread andy baum
h To: "dgr...@dagconsulting.com" ; U2 Users List Sent: Wednesday, 7 December 2011, 18:57 Subject: Re: [U2] End of Month date routine I added the code to PasteBin so as to not flood here: http://pastebin.com/JMyqhFud I did a few more than 100K and I cut the OCONV step out from all of th

Re: [U2] End of Month date routine

2011-12-07 Thread andy baum
heers, Andy   From: Daniel McGrath To: "dgr...@dagconsulting.com" ; U2 Users List Sent: Wednesday, 7 December 2011, 18:57 Subject: Re: [U2] End of Month date routine I added the code to PasteBin so as to not flood here: http://pastebin.com/JMyqhFud I did a few more than 100K and

Re: [U2] End of Month date routine

2011-12-07 Thread Boydell, Stuart
And seeing how this thread is petering out how about this alternative: meDate = date() currentMonth = oconv(meDate,'dm') loop while oconv(meDate + 1,'dm') = curMonth do meDate += 1 repeat Personally I vote for Marco's solution, though it may need brackets or an oconv.

Re: [U2] End of Month date routine

2011-12-07 Thread Wjhonson
List' Sent: Wed, Dec 7, 2011 12:23 pm Subject: Re: [U2] End of Month date routine Okay I took the fastest routine and made it into an $INSERT piece of code: YEAR = OCONV(THE.DATE, "DY") F MOD(YEAR,4) THEN LEAP.YEAR = 0 ND ELSE IF MOD(YEAR, 100) THEN LEAP.YEAR = 1

Re: [U2] End of Month date routine

2011-12-07 Thread David A. Green
Original Message- From: Daniel McGrath [mailto:dmcgr...@rocketsoftware.com] Sent: Wednesday, December 07, 2011 11:57 AM To: dgr...@dagconsulting.com; U2 Users List Subject: RE: [U2] End of Month date routine I added the code to PasteBin so as to not flood here: http://pastebin.com/JMyqhF

Re: [U2] End of Month date routine

2011-12-07 Thread Christine Callahan
D')-1 **END.OF.MONTH IS THE INTERNAL DATE FOR THE LAST DAY OF THE MONTH -Original Message- From: Marco Antonio Rojas Castro [mailto:marco_roja...@hotmail.com] Sent: Monday, December 05, 2011 3:49 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] End of Month date routine TOD

Re: [U2] End of Month date routine

2011-12-07 Thread Daniel McGrath
users-boun...@listserver.u2ug.org] On Behalf Of David A. Green Sent: Wednesday, December 07, 2011 10:48 AM To: 'U2 Users List' Subject: Re: [U2] End of Month date routine Who wants to take each of the Leap Year calculations and put them into different subroutines and loop 100K times and s

Re: [U2] End of Month date routine

2011-12-07 Thread Martin Braid
LEAP.YEAR needs to be FALSE at the start -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: 07 December 2011 18:49 To: u2-users@listserver.u2ug.org Subject: Re: [U2] End of Month date routine Because

Re: [U2] End of Month date routine

2011-12-07 Thread Wjhonson
Oops, maybe all those Mods in my code are supposed to be... NOT(MOD... Just maybe -Original Message- From: Daniel McGrath To: U2 Users List Sent: Wed, Dec 7, 2011 10:22 am Subject: Re: [U2] End of Month date routine That doesn't give the correct results, although removin

Re: [U2] End of Month date routine

2011-12-07 Thread Wjhonson
Because ? -Original Message- From: Daniel McGrath To: U2 Users List Sent: Wed, Dec 7, 2011 10:22 am Subject: Re: [U2] End of Month date routine That doesn't give the correct results, although removing the comparisons with 0 ill improve it's performance - as you say. --

Re: [U2] End of Month date routine

2011-12-07 Thread Daniel McGrath
ecember 07, 2011 10:29 AM To: u2-users@listserver.u2ug.org Subject: Re: [U2] End of Month date routine This algorithm is redundant and also fails to take into account the Boolean nature of the terms and thus adds extra unneeded op codes in the compare to 0 and compare to 1 steps. Below is the

Re: [U2] End of Month date routine

2011-12-07 Thread David A. Green
Who wants to take each of the Leap Year calculations and put them into different subroutines and loop 100K times and see which one is faster using profiling? David A. Green (480) 813-1725 DAG Consulting ___ U2-Users mailing list U2-Users@listserver.u2ug

Re: [U2] End of Month date routine

2011-12-07 Thread Wjhonson
P.YEAR = 0 -Original Message- From: Daniel McGrath To: U2 Users List Sent: Wed, Dec 7, 2011 8:02 am Subject: Re: [U2] End of Month date routine Perfectly fine except if you need to run this is a very large loop (such as atch processing 100 million records - although it only adds about 1

Re: [U2] End of Month date routine

2011-12-07 Thread Wjhonson
SYSTEM(36) BEGIN CASE CASE INT.DATE.FORMAT = 0 ; DATE.FORMAT = "MD" CASE INT.DATE.FORMAT = 1 ; DATE.FORMAT = "DM" CASE 1 ; GOSUB UNSUPPORTED.DATE.FORMAT END CASE RETURN ! NSUPPORTED.DATE.FORMAT: MSG = "Unsupported Da

Re: [U2] End of Month date routine

2011-12-07 Thread Daniel McGrath
0 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David A. Green Sent: Wednesday, December 07, 2011 8:25 AM To: 'U2 Users List' Subject: Re: [U2] End of Month date routine YEAR = OCONV(PASS.DATE, "DY") TEST = ICON

Re: [U2] End of Month date routine

2011-12-07 Thread David A. Green
NT.DATE.FORMAT = 1 ; DATE.FORMAT = "DM" CASE 1 ; GOSUB UNSUPPORTED.DATE.FORMAT END CASE RETURN ! UNSUPPORTED.DATE.FORMAT: MSG = "Unsupported Date Format ":DQUOTE(SYSTEM(36)) GOSUB ABORT.MSG RETURN ! INVALID.TYPE:

Re: [U2] End of Month date routine

2011-12-07 Thread David A. Green
f Daniel McGrath Sent: Tuesday, December 06, 2011 4:22 PM To: U2 Users List Subject: Re: [U2] End of Month date routine Leap years are a little more complex than MOD(YEAR,4) >From http://en.wikipedia.org/wiki/Leap_years#Algorithm if year modulo 4 is 0 then if year modulo 100 is 0

Re: [U2] End of Month date routine

2011-12-06 Thread Keith Johnson [DATACOM]
Mr Castro's code wins. Pure elegance. Marco Antonio Rojas Castro - initials M.A.R.C. My uncle's name is Roy Owen Young - I tease him it's so he can remember it. Regards, Keith ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserve

Re: [U2] End of Month date routine

2011-12-06 Thread Wjhonson
Can I *improve* on your method? Months = '31,':(28+Leap):',31,30,31,30,31,31,30,31,30,31' Last.day = FIELD(Months,",",Month) -Original Message- From: John Hester To: U2 Users List Sent: Tue, Dec 6, 2011 3:15 pm Subject: Re: [U2] End of Month date routine

Re: [U2] End of Month date routine

2011-12-06 Thread Daniel McGrath
ect: Re: [U2] End of Month date routine Your method is also the way I've always done it, but an alternate method just came to mind: MONTH = OCONV(DATE, 'DM') YEAR = OCONV(DATE, 'D Y[Z4]') LEAP = MOD(YEAR, 4) = 0 MONTHS = '' MONTHS<1> = 31 MONTHS<2>

Re: [U2] End of Month date routine

2011-12-06 Thread John Hester
al Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Holt, Jake Sent: Tuesday, December 06, 2011 2:34 PM To: U2 Users List Subject: Re: [U2] End of Month date routine Someone has probably already suggested one like this but I use: DATE

Re: [U2] End of Month date routine

2011-12-06 Thread Holt, Jake
27;D')-1 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Hatherill Sent: Tuesday, December 06, 2011 3:33 PM To: U2 Users List Subject: Re: [U2] End of Month date routine Tdate = OCONV(DATE(),"D4-") mm1= T

Re: [U2] End of Month date routine

2011-12-06 Thread John Hatherill
l Message- From: Rick Nuckolls To: U2 Users List Sent: Mon, Dec 5, 2011 5:00 pm Subject: Re: [U2] End of Month date routine Just for laughs, the following works with only a single date conversion, though will admit that it gets a little too obscure to be considered maintainable. dmittedly,

Re: [U2] End of Month date routine

2011-12-06 Thread Colin Alfke
That's better. It wasn't the ';' in the last one that caused the problem - especially with a generic routine - it was the reliance on the date format being m/d/y (which Dave's original noted). Not sure why you're trying so hard to compress the lines. This routine will easily fit in pretty much any

Re: [U2] End of Month date routine

2011-12-05 Thread Wjhonson
Okay you win the prize for the longest method ;) -Original Message- From: Rick Nuckolls To: U2 Users List Sent: Mon, Dec 5, 2011 5:00 pm Subject: Re: [U2] End of Month date routine Just for laughs, the following works with only a single date conversion, though will admit

Re: [U2] End of Month date routine

2011-12-05 Thread Rick Nuckolls
XT.MO - OCONV(A.DAY.NEXT.MO,'DD') > > > > > -Original Message- > From: Wjhonson > To: u2-users > Sent: Mon, Dec 5, 2011 2:15 pm > Subject: Re: [U2] End of Month date routine > > > > arco, this is absolutely brilliant. > nd I reserve the

Re: [U2] End of Month date routine

2011-12-05 Thread Keith Johnson [DATACOM]
Dave Laansma took a more generic approach which does not require knowledge of the date format - hence I thought it preferable. My style would move the addition and subtraction around as below I assumed one would want the last day of the month for any called date otherwise uncomment line 2 SUBROUT

Re: [U2] End of Month date routine

2011-12-05 Thread Wols Lists
d work. Cheers, Wol George -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wols Lists Sent: Monday, December 05, 2011 3:05 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] End of Month date routine On 05/12/11

Re: [U2] End of Month date routine

2011-12-05 Thread Wols Lists
: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wols Lists Sent: Monday, December 05, 2011 3:05 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] End of Month date routine On 05/12/11 19:03, Wjhonson wrote: Does someone have a routine that, no

Re: [U2] End of Month date routine

2011-12-05 Thread Wjhonson
.MO,'DD') -Original Message- From: Wjhonson To: u2-users Sent: Mon, Dec 5, 2011 2:15 pm Subject: Re: [U2] End of Month date routine arco, this is absolutely brilliant. nd I reserve the use of the word "brilliant", for code that truly transcends ormal space-time 'm n

Re: [U2] End of Month date routine

2011-12-05 Thread Wjhonson
-Original Message- From: Marco Antonio Rojas Castro To: u2-users Sent: Mon, Dec 5, 2011 12:49 pm Subject: Re: [U2] End of Month date routine ODAY = DATE() OM = TODAY - TODAY"DD" + 32 OM = EOM - EOM"DD" > To: u2-users@listserver.u2ug.org From: wjhon...@aol.c

Re: [U2] End of Month date routine

2011-12-05 Thread Wjhonson
MONTH = 1 ; YEAR += 1 END ELSE MONTH += 1 FIRST.OF.MONTH = ICONV(MONTH:"/01/":YEAR,'D') END.OF.MONTH.DATE = FIRST.OF.MONTH-1 -Original Message- From: Colin Alfke To: 'U2 Users List' Sent: Mon, Dec 5, 2011 12:50 p

Re: [U2] End of Month date routine

2011-12-05 Thread Phil Walker
Actually that will not work for a date near the end of the month. Was trying to be too smart > -Original Message- > From: Phil Walker > Sent: Tuesday, 6 December 2011 10:47 a.m. > To: 'U2 Users List' > Subject: RE: [U2] End of Month date routine > >

Re: [U2] End of Month date routine

2011-12-05 Thread Phil Walker
Sent: Tuesday, 6 December 2011 10:29 a.m. > To: 'U2 Users List' > Subject: Re: [U2] End of Month date routine > > Agreed. That code is almost verbatim what I have used for 20+ years, and it > has never failed me. > > > > > > > > > John Israe

Re: [U2] End of Month date routine

2011-12-05 Thread Israel, John R.
Charlie Noah Sent: Monday, December 05, 2011 4:27 PM To: U2 Users List Subject: Re: [U2] End of Month date routine I vote for the method (already posted) which will work every time on any MV system, any flavor, any emulation: find the first day of the next month and subtract 1. Messing around with adding

Re: [U2] End of Month date routine

2011-12-05 Thread Charlie Noah
working -Original Message----- From: George Gallen To: U2 Users List Sent: Mon, Dec 5, 2011 12:10 pm Subject: Re: [U2] End of Month date routine Haven't checked it, but what happens on 01/31 by adding 31, it should take you arch, backing up Will give you 02/xx (28 or 29)? Ge

Re: [U2] End of Month date routine

2011-12-05 Thread Rick Nuckolls
ad the "01" into > it or something > so i just get 31 at that point. > > I think you were expecting that it would take "12 2011" and make it into "12 > 01 2011" or whatever > but it's not working > > > > > -----Original Messag

Re: [U2] End of Month date routine

2011-12-05 Thread Marco Antonio Rojas Castro
ONV(15737, "D") = "31 JAN 2011" * WORKS FINE - UDT 7.1.7 (AIX) > Date: Mon, 5 Dec 2011 15:52:40 -0500 > From: dlaan...@hubbardsupply.com > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] End of Month date routine > > No, this will fail on January 31st, eve

Re: [U2] End of Month date routine

2011-12-05 Thread Dave Laansma
users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Marco Antonio Rojas Castro Sent: Monday, December 05, 2011 3:49 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] End of Month date routine TODAY = DATE() EOM = TODAY - TODAY"DD" + 32 EOM = EOM -

Re: [U2] End of Month date routine

2011-12-05 Thread Colin Alfke
Doesn't work for me :( Tried on UD 7.1.6 and UD 6.0.12. It works for December, but I changed it to March and it gave me January 3rd. UniData does have a nice function LAST_DAY(x) for using in virtual attributes to return the last day of the month for the date passed to it. hth Colin Calgary, Can

Re: [U2] End of Month date routine

2011-12-05 Thread Marco Antonio Rojas Castro
TODAY = DATE() EOM = TODAY - TODAY"DD" + 32 EOM = EOM - EOM"DD" > To: u2-users@listserver.u2ug.org > From: wjhon...@aol.com > Date: Mon, 5 Dec 2011 15:16:02 -0500 > Subject: Re: [U2] End of Month date routine > > > Doesn't work on my system A

Re: [U2] End of Month date routine

2011-12-05 Thread George Gallen
g.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Robert Houben Sent: Monday, December 05, 2011 3:30 PM To: U2 Users List Subject: Re: [U2] End of Month date routine But that would break the rhyme... :o -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users

Re: [U2] End of Month date routine

2011-12-05 Thread Robert Houben
But that would break the rhyme... :o -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: December-05-11 12:26 PM To: U2 Users List Subject: Re: [U2] End of Month date routine Damn February...We need

Re: [U2] End of Month date routine

2011-12-05 Thread George Gallen
...@listserver.u2ug.org] On Behalf Of Dave Laansma Sent: Monday, December 05, 2011 3:21 PM To: U2 Users List Subject: Re: [U2] End of Month date routine Ditto. Sincerely, David Laansma IT Manager Hubbard Supply Co. Direct: 810-342-7143 Office: 810-234-8681 Fax: 810-234-6142 www.hubbardsupply.com "Deliv

Re: [U2] End of Month date routine

2011-12-05 Thread Dave Laansma
users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: Monday, December 05, 2011 3:10 PM To: U2 Users List Subject: Re: [U2] End of Month date routine Haven't checked it, but what happens on 01/31 by adding 31, it should take you March, backing up Will give you 02/xx (28

Re: [U2] End of Month date routine

2011-12-05 Thread Wjhonson
make it into "12 01 2011" or whatever but it's not working -Original Message- From: George Gallen To: U2 Users List Sent: Mon, Dec 5, 2011 12:10 pm Subject: Re: [U2] End of Month date routine Haven't checked it, but what happens on 01/31 by adding 31, it should t

Re: [U2] End of Month date routine

2011-12-05 Thread George Gallen
onday, December 05, 2011 3:05 PM To: u2-users@listserver.u2ug.org Subject: Re: [U2] End of Month date routine On 05/12/11 19:03, Wjhonson wrote: > > Does someone have a routine that, no matter what day you run it, returns the > End of Month Date ? > (Assume the end of month date, is th

Re: [U2] End of Month date routine

2011-12-05 Thread Wols Lists
On 05/12/11 19:03, Wjhonson wrote: Does someone have a routine that, no matter what day you run it, returns the End of Month Date ? (Assume the end of month date, is the calendar end of month date not some screwy business date) Hmmm... no-one seems to have done my approach ... TODAY = @DATE

Re: [U2] End of Month date routine

2011-12-05 Thread Wjhonson
Thanks to everyone who responded This is with what I ended up MONTH = OCONV(DATE(),'DM') ; YEAR = OCONV(DATE(),'DY') IF MONTH = 12 THEN MONTH = 1 ; YEAR += 1 ELSE MONTH += 1 FIRST.OF.MONTH = ICONV(MONTH:"/01/":YEAR,'D') END.OF.MONTH.DATE = FIRST.OF.MONTH-1 The only

Re: [U2] End of Month date routine

2011-12-05 Thread Dave Laansma
tserver.u2ug.org] On Behalf Of charles_shaf...@ntn-bower.com Sent: Monday, December 05, 2011 2:22 PM To: U2 Users List Subject: Re: [U2] End of Month date routine Here's one I use. TODAY = OCONV(DATE(), "D4/") MO = FIELD(TODAY, "/", 1) YR = FIELD(TODAY, "/",

Re: [U2] End of Month date routine

2011-12-05 Thread Charles_Shaffer
Analyst NTN-Bower Corporation From: Wjhonson To: u2-users@listserver.u2ug.org, Date: 12/05/2011 01:03 PM Subject:[U2] End of Month date routine Sent by:u2-users-boun...@listserver.u2ug.org Does someone have a routine that, no matter what day you run it, returns the End o

Re: [U2] End of Month date routine

2011-12-05 Thread Wjhonson
though the string is '01' -Original Message- From: John Thompson To: U2 Users List Sent: Mon, Dec 5, 2011 11:16 am Subject: Re: [U2] End of Month date routine This may not be the cleanest way, but, we use it here and it works. used ABORT, so some parent program or para

Re: [U2] End of Month date routine

2011-12-05 Thread John Thompson
ayNextMonth = Iconv(Month:"/01/":Year,'D') ;* assumes MM/DD/ > format > LastDayThisMonth = FirstDayNextMonth - 1 ;* self-explanatory. > > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto: > u2-users-boun...@listserver.u2ug.org] O

Re: [U2] End of Month date routine

2011-12-05 Thread Horacio Pellegrino
Using NEXT.MONTH and proper YEAR: ICONV(NEXT.MONTH:'/01/':YEAR)-1 will make the trick. HP On Mon, Dec 5, 2011 at 2:03 PM, Wjhonson wrote: > > Does someone have a routine that, no matter what day you run it, returns > the End of Month Date ? > (Assume the end of month date, is the calendar en

Re: [U2] End of Month date routine

2011-12-05 Thread Dave Davis
assumes MM/DD/ format LastDayThisMonth = FirstDayNextMonth - 1 ;* self-explanatory. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: Monday, December 05, 2011 2:03 PM To: u2-users@listserver.u2ug.org Subject: [U2] En

[U2] End of Month date routine

2011-12-05 Thread Wjhonson
Does someone have a routine that, no matter what day you run it, returns the End of Month Date ? (Assume the end of month date, is the calendar end of month date not some screwy business date) ___ U2-Users mailing list U2-Users@listserver.u2ug.org http