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


  • Subject: Re: Bug in Lookup?
  • From: boldt@xxxxxxxxxx
  • Date: Fri, 7 Jul 2000 15:22:40 -0400



Jim Wrote:
>I have some variables declared for a lookup table:
>D AgeDates        S               D   Dim(4) Inz(d'0001-01-01') Ascend
>D InvoiceDate     S               D   Inz(d'0001-01-01')
>D Per             S              3S 0 Inz(*Zero)
>
>I have a routine that goes through these 4 dates and sets value for them,
>and in debug they show as:
>
>> EVAL AgeDates
>  AGEDATES(1) = '2000-06-07'
>  AGEDATES(2) = '2000-05-08'
>  AGEDATES(3) = '2000-04-08'
>  AGEDATES(4) = '2000-03-09'
>
>INVOICEDATE = '1994-01-07'
>
>Then I get to the call:
>C                   Eval      Per = *Zero
>C     InvoiceDate   Lookup    AgeDates(Per)                        9999
>
>I get an error.
>
> Message ID . . . . . . :   RNX0112
> Date sent  . . . . . . :   07/07/00      Time sent  . . . . . . :
10:45:32
>Message . . . . :   Date, Time or Timestamp value is not valid.
>
>Cause . . . . . :   The Date, Time or Timestamp value is not valid. Some
>  examples of values which are not valid are:
>    -- A date of 1994/02/31, which is not possible.
>    -- A time of 01/03:04, which does not have correct separators.
>Recovery  . . . :   Correct the value of the Date, Time or Timestamp
field.
>
>What, if anything, am I doing wrong?  And if I'm not doing anythign wrong,
is
>this an RPG error?  Do I need to convert these dates to YMD numeric format
>instead?

You've declared the array to be ascending sequence, but the debug shows
the actual data to be in descending order.

OK, perhaps the LOOKUP should be a bit more robust and handle the
error more gracefully, but basically, you're lying to RPG.  See what
happens if you code DESCEND on the array definition instead.

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.