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



Follow up on previous post.

The following is from the V5R3 manual (Coding SQL statements in ILE RPG
for iSeries applications) so I am more confused.

For all statements, other than the blocked FETCH and blocked INSERT, if
an occurrence data structure is used, the current occurrence is used.
For the blocked FETCH and blocked INSERT, the occurrence is set to 1.
The following example uses a host structure array called DEPARTMENT and
a blocked FETCH statement to retrieve 10 rows from the DEPARTMENT table.

DDEPARTMENT DS OCCURS(10)
D DEPTNO 01 03A
D DEPTNM 04 32A
D MGRNO 33 38A
D ADMRD 39 41A

DIND_ARRAY DS OCCURS(10)
D INDS 4B 0 DIM(4)
...
C/EXEC SQL
C+ DECLARE C1 CURSOR FOR
C+ SELECT *
C+ FROM CORPDATA.DEPARTMENT
C/END-EXEC
...

C/EXEC SQL
C+ FETCH C1 FOR 10 ROWS
C+ INTO :DEPARTMENT:IND_ARRAY
C/END-EXEC

Blocked FETCH and blocked INSERT are the only SQL statements that allow
a data structure with the DIM keyword. A host variable reference with a
subscript like MyStructure(index).Mysubfield is not supported by SQL.
Example:
Dfststruct DS DIM(10) QUALIFIED

D sub1 4B 0
D sub2 9B 0
D sub3 20I 0
D sub4 9B 0

C/EXEC SQL
C+ FETCH C1 FOR 10 ROWS INTO :fststruct
C/END-EXEC


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.