Re: [U2] ISO Date Format

2013-03-11 Thread John Hatherill
D-YMD

John W Hatherill
Programmer / Analyst
Harrington Industrial Plastics 

-Original Message-
From: Jeff Schasny [mailto:jscha...@gmail.com] 
Sent: Monday, March 11, 2013 6:57 AM
To: U2-Users@listserver.u2ug.org
Subject: [U2] ISO Date Format

Has anyone come up with an OCONV string that will product an ISO standard date 
(-MM-DD)? After a vendor insisted on this last week I ended up creating a 
subroutine called by an I descriptor but it seems like there should be an 
easier way. A quick trip through the Universe Basic manual, my old Prime 
Info-Basic manual, and Pick Basic: A programmer's guide didn't shed any light.
--

Jeff Schasny - Denver, Co, USA
jschasny at gmail dot com


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] The CONTINUE statement

2012-04-27 Thread John Hatherill

Good for you for speaking up. 
Like so many things. It's not the Tool that's good or bad, its how and why it's 
used.
Spaghetti code did not end with the banishment of GOTO's. It just got a new set 
of clothes. ;)


John Hatherill


-Original Message-
From: Laura Hirsh [mailto:la...@lhirsh.org] 
Sent: Friday, April 27, 2012 10:59 AM
To: 'U2 Users List'
Subject: Re: [U2] The CONTINUE statement

OK. I'm going to come clean. At the cost of my reputation, and future
projects. I LIKE GOTO! Sadly (for me), because all of the negative press
this four letter word receives I don't use it anymore. No need to comment,
or start a flame war, I just thought I'd fess up! :)

Laura Hirsh

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Corrupted compiled code

2011-12-21 Thread John Hatherill
It sounds crazy but humor me. I have seen when commands are imbedded in a 
variable name in some systems it has problems. That's why I go out of my way 
not to put them in my variable names.  In this case CRT.  Rename the variable 
and see what happens?  It's a long shot but stranger things have happened.

John W Hatherill
-Original Message-
From: Bill Haskett [mailto:wphask...@advantos.net] 
Sent: Tuesday, December 20, 2011 7:40 PM
To: U2 Mail List
Subject: [U2] [UD] Corrupted compiled code

I've been using UD for a number of years.  I'm currently using v7.2.7.  
Occasionally, the compiled code gets corrupted.  I notice when a client 
calls and indicates something doesn't work.  Today I couldn't create an 
A/P check.  After a few hours I tracked down the following message:

In E:\Abo\BP\BP\_APCHECK at line 60 can not use debugger for background job
In E:\Abo\BP\BP\_M.APCHECK at line 343 Phantom run basic error, exit 4.

Line 60 of APCHECK looks like:

IF GUIMODE THEN SuppressCRT = 1 ELSE SuppressCRT = 0

I figured I'd left a DEBUG statement in APCHECK when I called 
M.APCHECK (which executes APCHECK from a phantom).  I didn't!  
Everything looked good.  I finally added a simple VOC 
debug-record-writev to theAPCHECK program , recompiled it and reran 
the process.  All worked fine!  I took out the debug code and everything 
works fine.  So, recompiling was all it took because the object code was 
corrupted somehow.

Yesterday, I spent 12 hours tracking down an intermittent browser crash 
for one of our clients and finally came to a BUILD.HEADING program I've 
been using since 1995.  What happened was that SYSTEM(2) was returning 
the value 1024 instead of 80.  So, when I created a three line heading 
and centered stuff on each line, instead of 30 (or so) spaces created on 
each side of the heading line I had about 450.  When the heading info 
was added to the ECL command the line was too long and barfed when it 
was executed.  No error message appeared anywhere so it was with a lot 
of effort I was able to track this down.  Upon adding a 
writev-debug-line and recompiling, everything started working just 
fine.  I removed the debug line and all is working well.

Naturally I've recompiled everything and rebooted the server, but this 
is a major pain in the a$$!  Does anyone know why code that's been used 
for months, and maybe years, would get corrupted like this?  Everything 
is compiled with the '-Z2' option and all cataloging is local (DIRECT 
FORCE).

Thanks,

Bill

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] End of Month date routine

2011-12-06 Thread John Hatherill


Tdate = OCONV(DATE(),D4-)
mm1= Tdate[1,2]+1
1 = Tdate[7,4]
if mm1  12 then
  mm1 = 01
  1 += 1
end
EDATE = ICONV(mm1:-01-:1,D4-) - 1
EDATE = OCONV(EDATE,D2/); here is external format end-of-month 

-Original Message-
From: Rick Nuckolls r...@lynden.com
To: U2 Users List u2-users@listserver.u2ug.org
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, there are probably easier ways to tell how many days there are in a 
onth, but they may not be as much fun!
Rick Nuckolls
ynden Inc

extdate = oconv( d, 'D4-YMD')
 year = field(extdate, '-',1)
month = field( extdate, '-', 2)
dom = field(extdate,'-',3)
 if month = 2 then
   daysinmonth = 28 + ( not(mod(year,4))  ( mod(year,100) ! 
ot(mod(year,400)) ))
end else
   daysinmonth = 30 + mod( if month  8 then abs(month-2) else month-7, 
)
end
 lastdayofmonth = d - dom + daysinmonth

n Dec 5, 2011, at 2:26 PM, Wjhonson wrote:
 
 I changed Marco's code slightly using Oconv to make it more clear what DD is 
oing and make it more generic
 I'm also adding 40 instead of 32 to make it clear that we don't care how much 
e are adding as long as it's between 32 and 57
 To make it clear what this is doing, we are taking the internal date, and 
ubtracting from that the day number on which we are running.
 This will *always* give you the last day of the previous month.  Always.
 Then we add enough to jump us into the next month anywhere, doesn't matter at 
ll.
 And then do the same trick again, which will *always* give you the last day of 
he month in which you are running
 This is a fantastic bit of magic.
 
 
   TODAY = DATE() ; LAST.MO.END = TODAY - OCONV(TODAY,'DD')
   A.DAY.NEXT.MO = LAST.MO.END + 40
   END.OF.MO.DATE = A.DAY.NEXT.MO - OCONV(A.DAY.NEXT.MO,'DD')
 
 
 
 
 -Original Message-
 From: Wjhonson wjhon...@aol.com
 To: u2-users u2-users@listserver.u2ug.org
 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 not certain that the use of DD is vendor independent, but it could be 
ade 
 o, by merely using OCONV(TODAY, 'DD') instead
 
 -Original Message-
 rom: Marco Antonio Rojas Castro marco_roja...@hotmail.com
 o: u2-users u2-users@listserver.u2ug.org
 ent: Mon, Dec 5, 2011 12:49 pm
 ubject: Re: [U2] End of Month date routine
 
 ODAY = DATE()
 M = TODAY - TODAYDD + 32
 M = EOM - EOMDD
 
 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 Anthony.
 The This month o gives the month and year ok
 but the attempt to iconv that sets it to zero, it doesn't pad the 01 into it 
 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 
 2011 or whatever
 but it's not working
 
 
 
 
 -Original Message-
 From: George Gallen ggal...@wyanokegroup.com
 To: U2 Users List u2-users@listserver.u2ug.org
 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)?
 George
 -Original Message-
 rom: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
 n Behalf Of Wols Lists
 ent: Monday, December 05, 2011 3:05 PM
 o: u2-users@listserver.u2ug.org
 ubject: 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 
 nd of Month Date ?
 (Assume the end of month date, is the calendar end of month date not some 
 crewy business date)
 Hmmm... no-one seems to have done my approach ...
 TODAY = @DATE
 HIS.MONTH.O = OCONV (TODAY, DMY) ;* strip day off
 EXT.MONTH.I = ICONV( THIS.MONTH.O, D) + 31 ;* random day next month
 EXT.MONTH.O = OCONV( NEXT.MONTH.I, DMY) ;* strip day off
 AST.DAY.I = ICONV( NEXT.MONTH.O, D) - 1 ;* subract one day
 If you don't have a day in your i/oconv it defaults to 1, so the logic 
 orks. Unfortunately you can't combine the first three lines because 
 here's no number you can pick that will guarantee to land you in next 
 onth whatever today's date :-(
 Cheers,
 ol
 __
 2-Users mailing list
 2-us...@listserver.u2ug.org
 ttp://listserver.u2ug.org/mailman/listinfo/u2-users
 __
 2-Users mailing list
 2-us...@listserver.u2ug.org
 ttp://listserver.u2ug.org/mailman/listinfo/u2-users
 
 ___