Here's what I used for V3R2  (posted to the RPG list about a year ago).

h dftactgrp(*no) bnddir('QC2LE')

 * set space pointer offset
d setsppo         pr              *   extproc('setsppo')
d  Pointer                        *   value
d  Offset                       10i 0 value
 * store space pointer offset
d stsppo          pr            10i 0 extproc('stsppo')
d  Pointer                        *   value

* add len to buffer pointer
c                   eval      BufrP = setsppo(BufrP:stsppo(BufrP)+len)


----- Original Message ----- 
From: "Douglas Handy" <dhandy1@xxxxxxxxxxxxx>
To: "MI Programming on the AS400 / iSeries" <mi400@xxxxxxxxxxxx>
Sent: Monday, October 13, 2003 8:15 AM
Subject: Re: [MI400] RE: MI Emulator

> Jon / Richard,
> > >> seeing that V3R2 RPG does not have pointer arithmetic capability?
> >Simple, just write a little MI program ...
> >
> >It is indeed simple - and a lot simpler than writing an MI program!
> >define an array over the field/DS (using BASED if needed) and use %Addr
> >the element required.
> What I did while still supporting V3R2 clients was still write a little MI
> program, but one which itself just did pointer arithmetic.  It accepted
> pointer itself, the offset, and (optionally) whether to ADD or SUB the
> from the pointer, with a default of addition.  Then it just used ADDSPP or
> SUBSPP and returned.
> This let me walk lists in user spaces very easily.  I'd prototype the call
> the MI program so I'd have code like
>      C                   Callp     AddToPtr( pEntry: EntrySize )
> or
>     C                    Callp     PtrMath( pEntry: offset: 'SUB' )
> or whatever.
> I always preferred that to the based array technique, plus it was not
limited to
> 32767 bytes.
> Doug
> _______________________________________________
> This is the MI Programming on the AS400 / iSeries (MI400) mailing list
> To post a message email: MI400@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit:
> or email: MI400-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at

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-2022 by 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.