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



Hi folks.

For anyone who has downloaded a copy of my iDate utility from
www.think400.dk/downloads.htm, I have posted a new version.

For those are new, iDate is my free utility to convert iSeries
dates(really character or numeric fields) to SQL date data types using a
User Defined SQL Function written in RPGLE. Complete information is
available in the README.

It could, also, be used in an RPG or SPL (Stored Procedure Language) to
convert a date. If you feed 2/7/07 into IBM's %Date() function it will
fail. It must be in a 02/07/07 but iDate will deal with it correctly.

Exec Sql Set YourField = Select iDate(iSeriesDate:'*MDY') From
sysibm/sysdummy1;

I have, also, included a document called "Instructions on Transferring
Save Files to the AS400.rtf" with detailed directions on 4 methods to
transfer save files or source to the AS/400.

Recently, someone posted a request for how to get the month and year
from a date formatted with separators and gave an example like 2/7/2007
and they wanted to select out where Month = 2 and Year = 2007

I tried and found out that iDate would not work so I upgraded code to
deal with formatted dates correctly so the following

Select *
From sysibm/sysdummy1
Where Month(iDate('2/7/2007':'*MDCCYY')) = 2 And
Year (iDate('2/7/2007':'*MDCCYY')) = 2007

would now work correctly.

iDate should deal with any correctly formatted field now.

2007-02-27 or 2-2-07 or 07/02/07 all would work.

2007 02 27 or 2007-02/27 would not work.

If someone finds something that does not work, please let me know.

I, also, added logic to deal with garbage characters (blanks) in a
numeric fields.

As an aside, because iDate is written in RPG/ILE and does so much
checking, if you wanted to check your date fields for invalid dates, the
following would work fine.

Select YourId,DateField
From YourFile
Where IfNull(iDate(DateField),0) = 0

Or

Select YourId, DateField
From YourFile
Where DateField <> 0 And
DateField <> 99999999 And
IfNull(iDate(DateField),0) = 0

Both examples assume your date field has the format of *CCYMD and iDate
is set for *CCYMD as the default date format.





As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.