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




On 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. The error is NOT caused by incorrectly converting 123110 to Julian but rather by attempting to convert 2010366 (an invalid Julian date) to MDY format.

You should examine the content of &HOLJUL after converting 123110. I think you'll find it is 2010365 (the correct value) thus something is occurring between that point and the later CVTDAT failure. Usual cause is attempting to use Julian dates for "easy" data arithmetic (i.e., adding or subtracting a number of days) and forgetting about the boundary conditions of yyyy001 and yyyy365 or yyyy366.

Your code needs to check the validity of the numeric calculation pretending to be a date calculation. If you go beyond 1 then decrement the year portion and adjust the days. If you go beyond 365 then if 366 check for leap year and if not a leap or greater than 366 then increment the year and adjust the days. You'll need to handle adding or subtracting more days than a single year if you want to do it properly. Seems to me this is crying out for a user-written command to perform the Julian date arithmetic. That way you can hide the messiness of the year and day adjustments in a common, reusable, chunk of code.

Regards,
Simon 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 ...

Follow-Ups:
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.