|
I like Barbara Morris' solution the best: The problem could be solved by using %dec to control the length of the result: %editc(%dec(fiscalYr-1:4:0):'X') While you might consider using a MOVE to avoid my complex substring solution, the %dec is simple, eloquent, and requires only a single operation. Charles L.Massoglia, President Massoglia Technical Consulting, Inc. cmassoglia@voyager.net In MI 517-676-9700 or in NC 919-363-9395 ----- Original Message ----- From: "Joe Pluta" <joepluta@PlutaBrothers.com> To: <rpg400-l@midrange.com> Sent: Tuesday, 26 February, 2002 12:41 Subject: RE: Strange behavior w/%editc() > > From: Charlie Massoglia > > > > You can easily circumvent this problem by coding as follows: > > > > c eval headdesc = Center('Fixed Model FY ' + > > c %subst(%editc(fiscalYr - > > 1:'X'):%len(%editc(fiscalYr - 1:'X') - 4) :40) > > Or you could do a MOVE (sigh). Or use a data structure. > > I'm guessing that a simple MOVE would probably have a little performance > advantage as well, but I could be wrong. In any event, just because there > are BIFs doesn't mean we have to use them, does it? Why not take advantage > of the things RPG is really good at, like data conversion via a simple MOVE > instruction? When you realize that you might have to string two or more > BIFs together to do the same function as a MOVE, might it not be time to > consider using the MOVE? > > Joe > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > >
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.