• Subject: RE: Basing Pointers
  • From: "David Morris" <dmorris@xxxxxxxxxxxxx>
  • Date: Fri, 14 May 1999 11:45:11 -0600

Colin,

I agree with you that the QSYSINC structures are not as flexible as 
they should be.  I would like to see an alternate version that defines 
them as based.  Another alternative would be to condition a based 
definition in the current structures so that they could be used either 
way.  I often reference the field in IBM's definition structure.  This 
allows them to be based and have more meaningful names, but I 
have better ways to spend my time.  

I have found that moving data is not a whole lot slower than working 
with pointers.  There is a tradeoff, but setting a pointer takes longer 
than a 16 byte move, I haven't experimented to find where the cutoff 
is, but I would be interested in finding out.

David Morris

>>> Colin Williams <Williamsc@technocrats.co.uk> 05/14/99 09:34AM >>>
No, that is the reverse of what I want to do.

Basically what I am doing in using /COPY to copy the data structures
defined for the OS/400 API's into  my program, which are held in
QRPGLESRC in QSYSINC.
If I want to set pointers up for each data structure for a particular
API, I would have to amend that source. The problem with that is that
the QSYSINC library will be possibly updated at each upgrade.
Now you may ask, why do I need to set up a pointer to each DS for a
particular API. 

Basically because I assume that setting a pointer would be faster than
%SUBST.
If you only have a pointer to a userspace, you would currently:  

 D APIdatastructure  DS
   
 D DSSpaceVar   S   32767      Based(SpcPtr)

 C         DO    Noofdataitems
 C         Eval  APIdatastructure =
%SUBST(DSSpaceVar:1:%LEN(APIdatastructure))     Put Data Item into
datastructure
 C         EXSR PROCES
Process Data Item
 C         Eval SpcPtr = SpcPtr + NextItemOffset
Set Var to Next Data Item
 C         Enddo


But what I would like to be able to do, taking the assumption that it
would be quicker is:

 D APIdatastructure  DS

 D Ptr  *
Pointer to User Space

 C         Eval  SpcPtr = Ptr + Offset
Set Pointer To First Data Item

 C         DO    Noofdataitems
 C         Eval  %ADDR(APIdatastructure) = SpcPtr
Put Data Item into datastructure
 C         EXSR PROCES
Process Data Item
 C         Eval SpcPtr = SpcPtr + NextItemOffset
Set Var to Next Data Item
 C         Enddo

I am assuming here that using pointers is much faster that substringing
charcter strings

Correct me if I am wrong, I am here to be enlightened.


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.