|
Scott, my d specs (although I like yours better):
* Start: data to store F/S Cashless Vend "Job" Info ----------------------
D job#MaxC C const(200)
D job#Max S 5I 0 Inz(job#MaxC)
D job#@ S 5I 0 Inz(0)
D job#Rows S 5I 0 Inz(0)
D job#DS DS
D job# 29A DIM(job#MaxC)
D Fset 2A Overlay(job#:01)
D SetLoc 4A Overlay(job#:03)
D SetDat 7S 0 Overlay(job#:07)
D PrnNum 4A Overlay(job#:14)
D BatNum 3S 0 Overlay(job#:18)
D JobNum 6S 0 Overlay(job#:21)
D RecSta 3S 0 Overlay(job#:27)
* End : data to store F/S Cashless Vend "Job" Info ----------------------
and code:
Exec SQL
DECLARE job#Csr CURSOR FOR
SELECT DISTINCT
fset, setloc, setdat, prnnum,
1 AS batnum,
0 AS jobnum,
recsta
FROM fspost
WHERE recsta = 100
ORDER BY 1,2,3,4;
Exec SQL OPEN job#Csr;
If SQLCOD <> *Zero;
RtnCde = 'ERR ';
PgmMsg = 'Open job#Csr error in FSJOB01R.aaMain: ' + SqlState;
// ??? LeaveSR;
Endif;
Clear job#DS;
Exec SQL FETCH job#Csr FOR :job#Max ROWS INTO :job#DS;
job#Rows = Sqler3;
Thank you Scott!
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Mildenberger
Sent: Thursday, October 03, 2013 7:56 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: fetch cursor into DS array errors
You mean like this
d NewInv e ds extname(APTRANS) qualified dim(100)
exec sql declare C1 cursor for
select kdacct, '', kdinv#,
digits(max(kdidte)), digits(max(kddudt)), sum(kdamt), count(*)
from APTRANS
group by kdacct, kdinv#
order by kdacct, kdinv#;
exec sql open C1;
exec sql fetch from C1 into :InvDs;
Although this works fine, I vaguely remember a couple of case where the SQL pre-compile can't find the definition of the DS, can't remember the details. What does your code look like?
Scott Mildenberger
Programmer/Analyst
Davis Transport Inc.
Missoula, MT
406-728-5510 x128
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Gary Thompson
Sent: Thursday, October 03, 2013 6:34 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: fetch cursor into DS array errors
the SQL pre-compile does not like my DS array, is it possible to correctly define/use a DS array for an SQL cursor with several columns?
--
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 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.