|
Mark, I noticed that the source for getAllInvGlMf is different in your two source postings. Which one is correct? I have a program that does a very similar process. I load a specific number of rows into a MODS. I do not always get the entire request result set. Many times I fill only two or three entries with the remainder elements being left at their initial values. I am wondering if the variable number of rows to return is having a problem with the fixed number of elements in the MODS. Change the field :count to 9999. You will only get back the number available I believe without an error or at least a warning. Thank you, Matt Tyler Mattt@wincofoods.com -----Original Message----- From: MWalter@hanoverwire.com [mailto:MWalter@hanoverwire.com] Sent: Tuesday, September 10, 2002 12:01 To: rpg400-l@midrange.com Subject: SQL problem Hello all, Could someone tell me why this datastructure is not usable: PgetAllInvGlMf B Export DgetAllInvGlMf PI * d numrecs 10i 0 DdtaLen S 10i 0 dcount S 10i 0 DdsData e DS extname(Invglmf) occurs(9999) D based(p_dsData) * retrieve the number of records to be returned c/exec sql c+ select COUNT(*) INTO :count FROM Invglmf c/end-exec * only process if there are records c if count > 0 * allocate the storage for the MODS c eval dtaLen = %size(dsData) * count c alloc dtaLen p_dsData * declare the cursor c/exec sql c+ DECLARE c CURSOR FOR c+ SELECT * FROM Invglmf c/end-exec * open the cursor c/exec sql c+ OPEN c c/end-exec * move the records from the cursor to the MODS c/exec sql c+ FETCH FROM c FOR :count ROWS INTO :dsData c/end-exec * close the Cursor c/exec sql c+ CLOSE c c/end-exec * set the records returned and return a pointer to the MODS c eval numRecs = count c return p_dsData * no records, return null. c else c return *null c endif P E The precompiler is telling me that dsData is not defined or available. Thanks, Mark Mark Walter Sr. Programmer/Analyst Hanover Wire Cloth a div of CCX, Inc. mwalter@hanoverwire.com http://www.hanoverwire.com 717.637.3795 Ext.3040 _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com 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.