|
Here is my statement:a
select IPROD,
ifnull((select IDESC from IIML01
where IPROD=T2.IPROD
fetch first row only),'') as IDESC,
ifnull((select IITYP from IIML01
where IPROD=T2.IPROD
fetch first row only),'') as IITYP,
grouping(Market), // 1 means null because of totalling
ifnull(Market,''),
sum(ILNET) as Sales
from T2
group by grouping sets(
(IPROD),
(IPROD, Market))
order by IPROD, grouping(Market) desc, Sales desc
From: Alan Campin <alan0307d@xxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 10/28/2014 03:36 PM
Subject: Re: SQL5011 with multi row fetch and integer type in Data
structure
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>
Could you send your SQL statement. I don't see what GROUP BY would return
0 or 1.Data
On Tue, Oct 28, 2014 at 1:27 PM, <darren@xxxxxxxxx> wrote:
As far as I can tell, its not validating on the actual value beingreturned
at this stage, however, in this case, I'm using the GROUPING aggregatewith
function, which, according to the SQL manual, returns a small integer
a value of 0 or 1.
From: Alan Campin <alan0307d@xxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 10/28/2014 03:21 PM
Subject: Re: SQL5011 with multi row fetch and integer type in
programstructure
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>
What does the data base table look like? Is this field a small integer?
Could you send the field from DSPFFD so we can see what type it is?
DB2 does not support a unsigned integer that I can see.
The reason that it is probably working on a single fetch is that SQL
precompiler issues individual move instructions to fields in the
sopointer
RPG would convert from signed to unsigned integer.
When you do multiple row fetch, the SQL precompiler just passes a
getto the data structure and the data just get moved in so it would not
declaration.converted to unsigned integer.
Anyway, that is my best guess.
On Tue, Oct 28, 2014 at 12:26 PM, <darren@xxxxxxxxx> wrote:
That was a little off. The final "Good" was a typo on the
integer),Itdefine
should show that I can use integer when fetching one row at a time:
Good:
D C1arr DS qualified INZ
D PROD 35
D DESC 50
D ITYP 2
D TotInd 3u 0
D Market 5
D Sales 19 7
exec sql fetch C1 into :C1arr;
From: darren@xxxxxxxxx
To: "midrange-RPG RPG message board" <rpg400-l@xxxxxxxxxxxx>
Date: 10/28/2014 02:23 PM
Subject: SQL5011 with multi row fetch and integer type in Data
structure
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>
I have the following declaration and then fetch statement. When I
TOTIND as a 3u 0 (meaning unsigned integer) or a 3i0 (signed
insteadthe3,0)
compiler gives me SQL5011. But, if I define TOTIND as 3p 0 (packed
it
compiles fine. Does anyone know what rule I'm breaking by using aninteger
here? The declare statement is going to be feeding a GROUPING(FIELD)
function into this variable. Also, if I don't use multi fetch,
(RPG400-L)(RPG400-L)just fetching 1 row at a time, its fine.
Fails:
D C1arr DS qualified dim(100) INZ
D PROD 35
D DESC 50
D ITYP 2
D TotInd 3u 0
D Market 5
D Sales 19 7
D
exec sql fetch C1 for 100 rows into :C1arr;
Good:
D C1arr DS qualified dim(100) INZ
D PROD 35
D DESC 50
D ITYP 2
D TotInd 3p 0
D Market 5
D Sales 19 7
D
exec sql fetch C1 for 100 rows into :C1arr;
Good:
D C1arr DS qualified dim(100) INZ
D PROD 35
D DESC 50
D ITYP 2
D TotInd 3p 0
D Market 5
D Sales 19 7
D
exec sql fetch C1 into :C1arr;
--
This is the RPG programming on the IBM i (AS/400 and 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.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
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.
This is the RPG programming on the IBM i (AS/400 and 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.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
--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.
This is the RPG programming on the IBM i (AS/400 and 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.
--
This is the RPG programming on the IBM i (AS/400 and 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 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.