|
Chandana Silva wrote:
<<SNIP>>
The Concatenation below works but the results are bad ..
Select sum(SALES)
From DaySales
WHERE CPY = 22 and SDSTR = 1234 AND
DIGITS(2009) CONCAT'-' CONCAT DIGITS (07) CONCAT'-'
CONCAT DIGITS(15) BETWEEN '2009-07-14' AND '2009-08-10';
I tried:
Select sum(SALES)
From DaySales WHERE CPY = 22 and SDSTR = 1234 AND
DIGITS(2009) CONCAT DIGITS (07) CONCAT DIGITS(15)
BETWEEN '20090714' AND '20090810';
Off by Ml.s
Suggesting that "results are bad" and "off by Ml.s" is not
helpful to those who might choose to assist.
The DIGITS() function will not automatically cast to a character
string matching the length of the numeric literal. The numeric
field or literal will need to have exactly two-digits in precision,
or must be CAST as such [before casting to its DIGITS character
string form]. The literals will be treated as integer, which have
a precision of ten. Per that error, the latter requests the
equivalent of:
"AND '000000200900000000070000000015' BETWEEN '20090714'..."
'20090810';
Multiplication below, Returns Zeo (.)
Select sum(SALES)
From DaySales WHERE SDCPY = 88 and SDSTR = 1234 AND
((2009*10000) + (07*100) + 15) BETWEEN '20090714' AND
<<SNIP>>
Similar to the prior poor explanation of results, what does
"returns zeo (.)" mean? Perhaps "zero records"? Seems odd, since
even though the expression is numeric and the comparison values are
character strings, the implicit cast of either should give the
results just as if all were instead, proper DATE data type values.
Regards, Chuck
--
This is the RPG programming on the IBM i / System i (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 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.