|
I introduced loop to test whether it is retrieving the data correctly
or not. And If i do not break loop using WWIND it is going into
infinite loop.
I used hard coded values because the sized of the header wont change
right (constant), I do not feel its worthy to calculate the size every
time.
As you mentioned to use user space. So here the assumption is that The
whole data will be returned during the first call it self right.
For my product programs have max of 9, 999,999 bytes (i guess) of
data. Creating user space more than this should solve the problem, if
API returns all the data in a single hit.
I am thinking of another approach. If this API does not work.
1) My calling program will dump by executing DUMP opcode.
2) In called program I will CPYSPLF *LAT spool file into Physical file
. Selct the required fiels by using SQLRPGLE in the dump. (Do u guys
have any source code to read through ILERPG DUMP and returns the
required data?)
On Sun, May 16, 2010 at 1:51 AM, Dennis Lovelady <iseries@xxxxxxxxxxxx>
wrote:
byI need a help on the API "QteDumpModuleVariables".called program ( both are ILERPG and compiled iwth DEBUG *ALL views)
Here I am trying to retrieve the variables of calling program in the
using the above API.files
The Calling program has HUGE number of variables, DSs and up to 20
each having more than 200 fields.bytes
Fo the API I have defined the receiver variable size as 51000.
1) For the First time It has returned around (BYtes Returned) 49,000
of data with Continuation handler <> *blanks and Number of variable<>
*Zeros. (Bu=ytes available is 449,000).variables
I have parsed the variables and sorted them in an array -
and their values.same as
2) For the second time I called the API with Continuation handle
in the previous call. Now it is returning - Bytes returned (48 byest)-
Bytes vailable (400,000) and Number of variables = *zero and Conhand=
*zero.there
******Means Here It is failing and Not returning the Data
*************
This message is more appropriate in the RPG400-L list. Please reply
only.proper
After you've put so much work into this, why would you set the error
structure (erDs) to low values? At a minimum, I would define it as a
error structure and tell the system the real number of bytesavailable (80
in this case).the
I have no idea why you would introduce the "do 10 times" loop toward
beginning of the code - data will be lost - but perhaps this is partof
initial debug?fact,
Your use of Off2Var is very like a kludge and prone to mishap. In
you're using hard-coded values throughout the program for settingyour
pointers. This can have disastrous results. You should takestatements like
the following to heart: "The caller must use the offset to nextvariable
field to find the start of the next module variable section and usethe
length of module variable section to determine the length of thecurrent
section." (The quote is from the documentation for the API inquestion.)
supplied
Having said all that, I believe that what you are running into, is a
situation where the next variable requires more space than you have
in the rcvrVar parameter. Although the documentation doesn't mentionthis
effect, my testing shows that if I need 10000 bytes for the nextvariable
and I supply less than that, the program repeated ends without errorand
without populating new data into the receiver variable (although thesolution works
continuation handle does change). Interesting. If the below
for you then you might want to pursue this with IBM as a bug. Itdoesn't
seem right to me.from
I got around it by receiving into a user space (where rcvrVar is
based(pSpace) and pSpace is the address of the user space (returned
QUSPTRUS). This is my standard method for receiving large orpotentially
large data (such as this API and the QDBRTVFD API as examples). Whenusing
this technique, supply a large number (I use 16000000) as the "sizeof the
return area. (Note that when I create user spaces, I also - bydefault -
create them with the "extendable" flag set. It's a shame IBM doesn'tallow
that flag on the QUSCRTUS call, but oh well. You can pick up myExtProc('QteDumpModuleVariables')
createUserSpace procedure at http://www.lovelady.com/api-samp/
Here's a look at some of the changes I made to your program:
d RtvVar Pr
d Rcvvar 50000 Options(*varSize)first
d RcvvarL 10i 0 Const
d Fmtnm 8 Const
d QPgmName 20 Const
d PgmTyp 10 Const
d ModName 10 Const
d DtaOpt 10i 0 Const
d Conhand 16 Const
d ErrCd Options(*varsize) LikeDS(erDs)
(Note addition of Const where appropriate. This allows me to use
non-variable data in the actual call.)
d RcvrHdr_T Ds Qualified Based(proto_only)
d Brtn 10i 0
d BAvl 10i 0
d NumVar 10i 0
d LibO 10
d Res 10
d ConHdr 16
D rcvrVar$ S *
D rcvrvar DS Qualified Based(rcvrVar$)
D hdr LikeDS(rcvrHdr)
D theRest 50000
Now I can (and will) use %Size(RcvrHdr_T) in calculating position of
variable section.and not
d erDs DS Inz
D bytesProv 10I 0 Inz(%Size(erDS))
D bytesAvail 10I 0 Inz(0)
D errID 7
D 1
D errData 4096
It's so easy! How in this world could someone be writing a debugger
have error handling in mind!???!!!?out
rcvrVar$ = createUserSpace(mySpace: 'My space') ;
//WWIND = 1;
rcvrVar.Hdr.conHdr = *Blanks ;
//DOW WWIND <10;
rtvvar(RcvrVar
: 16000000
: fmtName
: qPgmNm
: PgmTyp
: QPgmNm.Pgm
: dtaOpt
: rcvrVar.Hdr.conHdr
: erDs) ;
ModVarHdr$ = %Addr(rcvrVar) + %Size(rcvrHdr) ;
ModVarSec$ = ModVarHdr$ + %Size(modVarHdr) ;
// WWIND += 1;
//enddo;
I did not touch anything below this point since my goal was to figure
your issue and try to help you get past it. I see a few potentialproblems
below here, but don't want to set your style.see in
Do lose the constants (and Off2Var), and work off of variables as you
the setting of all these pointers. And let us know how it turns out.given;
Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Is there aught you would withold? All you have shall someday be
therefore, give now, that the season of giving may be yours and notyour
inheritors'."
-- Kahil Gibran
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.