× 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 need a help on the API "QteDumpModuleVariables".

Here I am trying to retrieve the variables of calling program in the
called program ( both are ILERPG and compiled iwth DEBUG *ALL views) by
using the above API.

The Calling program has HUGE number of variables, DSs and up to 20 files
each having more than 200 fields.

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 bytes
of data with Continuation handler <> *blanks and Number of variable <>
*Zeros. (Bu=ytes available is 449,000).
I have parsed the variables and sorted them in an array - variables
and their values.

2) For the second time I called the API with Continuation handle same as
in the previous call. Now it is returning - Bytes returned (48 byest) -
Bytes vailable (400,000) and Number of variables = *zero and Conhand =
*zero.
******Means Here It is failing and Not returning the Data
*************

This message is more appropriate in the RPG400-L list. Please reply there
only.

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 proper
error structure and tell the system the real number of bytes available (80
in this case).

I have no idea why you would introduce the "do 10 times" loop toward the
beginning of the code - data will be lost - but perhaps this is part of
initial debug?

Your use of Off2Var is very like a kludge and prone to mishap. In fact,
you're using hard-coded values throughout the program for setting your
pointers. This can have disastrous results. You should take statements like
the following to heart: "The caller must use the offset to next variable
field to find the start of the next module variable section and use the
length of module variable section to determine the length of the current
section." (The quote is from the documentation for the API in question.)

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 supplied
in the rcvrVar parameter. Although the documentation doesn't mention this
effect, my testing shows that if I need 10000 bytes for the next variable
and I supply less than that, the program repeated ends without error and
without populating new data into the receiver variable (although the
continuation handle does change). Interesting. If the below solution works
for you then you might want to pursue this with IBM as a bug. It doesn't
seem right to me.

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 from
QUSPTRUS). This is my standard method for receiving large or potentially
large data (such as this API and the QDBRTVFD API as examples). When using
this technique, supply a large number (I use 16000000) as the "size of the
return area. (Note that when I create user spaces, I also - by default -
create them with the "extendable" flag set. It's a shame IBM doesn't allow
that flag on the QUSCRTUS call, but oh well. You can pick up my
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 ExtProc('QteDumpModuleVariables')
d Rcvvar 50000 Options(*varSize)
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 first
variable section.

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 and not
have error handling in mind!???!!!?

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 out
your issue and try to help you get past it. I see a few potential problems
below here, but don't want to set your style.

Do lose the constants (and Off2Var), and work off of variables as you see in
the setting of all these pointers. And let us know how it turns out.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Is there aught you would withold? All you have shall someday be given;
therefore, give now, that the season of giving may be yours and not your
inheritors'."
-- Kahil Gibran



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.