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



I small integer would be 5i 0.

Scott


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of darren@xxxxxxxxx
Sent: Tuesday, October 28, 2014 1:27 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: SQL5011 with multi row fetch and integer type in Data structure

As far as I can tell, its not validating on the actual value being returned at this stage, however, in this case, I'm using the GROUPING aggregate function, which, according to the SQL manual, returns a small integer with 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 Data
structure
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 program so RPG would convert from signed to unsigned integer.

When you do multiple row fetch, the SQL precompiler just passes a pointer to the data structure and the data just get moved in so it would not get 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 declaration.
It
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
define TOTIND as a 3u 0 (meaning unsigned integer) or a 3i0 (signed
integer),
the
compiler gives me SQL5011. But, if I define TOTIND as 3p 0 (packed
3,0)
it
compiles fine. Does anyone know what rule I'm breaking by using an
integer
here? The declare statement is going to be feeding a GROUPING(FIELD)
function into this variable. Also, if I don't use multi fetch,
instead 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)
(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.



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

Follow-Ups:
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.