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



Barbara,

>If you insert a record with an out-of-range date, you get a data mapping
>error when you try to access the record...

If I use interactive SQL or SQL Scripts in iSeries Navigator and the actual
date format is *DMY, *YMD, *MDY, I can insert a record with a date out of
valid range, (i.e. lower than 1940-01-01) without any problems.
The record is inserted and shown correctly, if I change the date format to a
4-digit year format.
The date even can be changed to an other invalid or valid date without
changing the 2-digit date format.

If I do the same thing in embedded SQL, I get a data mapping error, because
additional fields for the API calls are created. These date fields don't get
the format defined in the H-Specs or *ISO, but the date format that is
specified in the compile option DATFMT or in an SET OPTION statement.
This can cause some problems because the default value for date format is
*JOB which is a date format with a 2-digit year.

If you define a host variable with DATFMT(*ISO), initialize this field with
*LOVAL and than try to insert or update a record using this host variable a
data mapping error may occur.

Birgitta

-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Barbara Morris
Gesendet: Montag, 31. Januar 2005 19:38
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: AW: Why RPG IV Sucks


HauserSSS wrote:
>
> Hi Barbara,
>
> What I never understood is:
>
> Why a date that is stored as 4Byte integer must be converted into a
readable
> representation.

Birgitta, I never really understood it either.  (It's not RPG's
decision.  RPG doesn't control how the dates appear in the I/O buffers,
and the system routines RPG uses for date calculations require formatted
dates).  Me personally, I always thought that it shouldn't need to be
converted to a readable representation until it had to be read by a
human (for example, display or printer file) or converted to character.

>
> SQL on the other hand does not care about the date format.
> Sure, it is used to make a date readable, but you don't get an error,
> if the date is out of range.
> It is even possible to insert records and calulation with dates,
> if they are out of range.
>

If you insert a record with an out-of-range date, you get a data mapping
error when you try to access the record...
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





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.