|
Kind depends on how you define "best." I'll admit it, I've never used movea much, because I didn't bother to study the documentation. I've used loops a lot. Seems like anything that uses pointers to shuffle stuff around and/or does storage mapping needs to be hidden inside a procedure to spare those who come after from needing to think about the details. That also means it has to work correctly. I think that's what's attractive about movea. > -----Original Message----- > From: bmorris@ca.ibm.com [mailto:bmorris@ca.ibm.com] > Sent: Wednesday, June 06, 2001 9:53 AM > To: RPG400-L@midrange.com > Subject: Re: MOVEA -> EVAL > > > > >Date: Tue, 5 Jun 2001 17:34:22 -0400 > >From: "Charlie Massoglia" <cmassoglia@voyager.net> > > > >Wouldn't the following be much easier to understand than > using pointers > and > >still far more efficient than a MOVEA? > > > >d ds > >d xarr1 100 dim(10) > >d arr1 overlay(xarr1) > >d ds > >d xarr2 10 dim(100) > >d arr2 overlay(xarr2) > > > >c eval > %subst(xarr2:1:%size(xarr1)) = xarr1 > >c eval xarr2 = xarr1 > > Charlie, if you intended the dim(10) to be on the arr fields > rather than > the xarr fields, then yes, that would work, and may be easier to > understand. > But your code doesn't handle the array starting indexes. > C MOVEA arr1(n) arr2(m) > > It's probably not _any_ more efficient than MOVEA. MOVEA just sets > pointers, > calculates lengths, and copies in one fell swoop. (None of > this applies > to MOVEA with numeric arrays - the compiler uses a loop for those, to > handle > conversions; you'd have to use a loop too (or possibly just > EVAL directly, > depending on the number of elements and starting indexes.) > > But, I'm still waiting for someone to post an example where > using MOVEA is > the best solution :) > > Barbara Morris +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-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 mailing list archive is Copyright 1997-2025 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.