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



You are right Scott, and I found that just before you responded.....but I
certainly like the last line better ......

Thanks Scott, I appreciate the response....




From:
Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
To:
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Date:
07/01/2008 02:41 PM
Subject:
Re: Having a date conversion issue



Hi Doug,

0101.05 TestDateN = %Dec(%Date(Tsw3:*Cymd):*Iso);
0101.06 TestDateN = %dec(%Date(TestDateN:*cymd)+ %days(1));

Shouldn't that second line have *iso instead of *cymd? You've already
converted the date to *ISO at that point...

I think the "receiver too small" error is coming from the fact that
you're trying to tell the system that an 8,0 date is actually a 7,0
date. So when the %date() BIF tries to read an 8-digit date, the
internal *CYMD can't hold the result. Changing the second line to *ISO
should solve that problem.

However... if you read what your code does (Step-by-step) you'll see
that it does this:

a) read numeric date from file
b) Convert numeric date (cymd) to date field
c) Convert date field to numeric field (iso)
d) convert numeric field (iso) to date field again
e) add a day to date field
f) convert back to numeric field, iso

Wouldn't it be a lot cleaner to convert it to a date once, add a day,
then convert it back to a number? Just one line of code like this:

TestDateN = %Dec(%Date(Tsw3:*Cymd) + %days(1):*Iso);

It just seems simpler... read the number (cymd), make it a date field,
add a day, convert it back to a number (iso).



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.