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




Thanks folks. Happy New Year!!!!!!!!!!!!





-----Original Message-----
From: Simon Coulter <shc@xxxxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Sent: Wed, Dec 30, 2009 5:09 pm
Subject: Re: CVTDAT Question



n 30/12/2009, at 11:46 PM, fbocch2595@xxxxxxx wrote:
My company runs a CL pgm that has been running for many years that
reads a date file and converts it to julian but when converting
123110 the pgm is returning CPF0555 due to 123110 being converted
to invalid julian date 2010366. Has anyone seen this type of
behavior b4 and how is it best resolved?
Correct interpretation of the error condition might shed some light.
he error is NOT caused by incorrectly converting 123110 to Julian but
ather by attempting to convert 2010366 (an invalid Julian date) to
DY format.
You should examine the content of &HOLJUL after converting 123110. I
hink you'll find it is 2010365 (the correct value) thus something is
ccurring between that point and the later CVTDAT failure. Usual cause
s attempting to use Julian dates for "easy" data arithmetic (i.e.,
dding or subtracting a number of days) and forgetting about the
oundary conditions of yyyy001 and yyyy365 or yyyy366.
Your code needs to check the validity of the numeric calculation
retending to be a date calculation. If you go beyond 1 then decrement
he year portion and adjust the days. If you go beyond 365 then if 366
heck for leap year and if not a leap or greater than 366 then
ncrement the year and adjust the days. You'll need to handle adding
r subtracting more days than a single year if you want to do it
roperly. Seems to me this is crying out for a user-written command to
erform the Julian date arithmetic. That way you can hide the
essiness of the year and day adjustments in a common, reusable, chunk
f code.
Regards,
imon Coulter.
-------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
-------------------------------------------------------------------


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.