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



Thanks Joe

don't know exactly where my brain was.

With your help my solution looks like this

S = %trim(S) + ' AND '
+ '('
+ 'DEC('
+ ' SUBSTR(DIGITS(AHBSDT),5,2)'
+ ' CONCAT'
+ ' SUBSTR(DIGITS(AHBSDT),1,4)'
+ ' ,6,0)'
+ ' BETWEEN '
+ SQFYY + SQFMM + SQFDD
+ ' AND '
+ SQTYY + SQTMM + SQTDD
+ ')';
endIF;
Jim Horn

------------------------------

message: 3
date: Thu, 11 Oct 2007 11:37:57 -0500
from: "Joe Pluta" <joepluta@xxxxxxxxxxxxxxxxx>
subject: RE: embedded sql date select

Well, you could convert the field from MDY to YMD using DIGITS and
SUBSTR
and DECIMAL, something like:

DECIMAL(
SUBSTR(DIGITS(MYDATE),5,2) CONCAT
SUBSTR(DIGITS(MYDATE),1,4), 6, 0)

Once you have it in a usable format, you can just use the BETWEEN
operator.
Of course, if you're dealing with pre-2000 dates you'll need to take
into
account the century.

Joe

> From: JDHorn@xxxxxxxxxxxxxx
>
> I am attempting to select records in a file on a date stored as
mdy in
> a
> 6s 0 field.
>
> could use the between option or as greater than one date and less
than
> another.
>
> so far my solutions are far from elegant.
>
> does anyone have an example of an rpg program to generate an sql
select
> statement to do this?
>
> the date fields in the file may have zeros or other invalid dates
in
> them

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.