× 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.



>>>Eventually I ended up coding
>>> MOVEL  Alpha      AlphaNum
>>> MOVE   Number     AlphaNum

>> All you need to do is locate an edit
>> code that doesn't suppress zeroes.

> That's what I thought I was doing by using
> edit code '3'.

Let's begin with the beginning.  The MOVE/MOVEL you posted leads me to
believe that you want xx 1234 to become 'XX01234'.  I can't be certain,
because I don't know the field lengths involved.  I can't tell if this is a
one-time problem or code going into a generic 'joining' subprocedure.  I'll
take a gamble and imagine that you are looking to simply translate the
MOVE/MOVEL with the following definitions into a BIF call that results in
'xx01234':
d Alpha           s              2    inz('xx')
d Number          s              5s 0 inz(1234)
d AlphaNum        s              7

You tried using the %editc BIF, with edit code 3.  Why pick 3?  Let's look
at the Edit Code table at the programming reference summary
http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/x091315234.htm  3
says 'Zero balances' and 'No sign'.  It doesn't explain what 'zero balances'
means however so let's dive in to the RPG Reference
http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c0925083197.htm
Check out the section entitled Summary of Edit Codes and look at the
examples; specifically, the examples for the columns labelled 'Zero
Balance-No decimal positions.'
http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/c0925083202.htm  We
can see that 'Zero Balances' in the summary does NOT mean that 00000 becomes
00000, it becomes 0.  One single zero.  All references located via the
search mechanism of Info Centre at http://www.iseries.ibm.com/infocenter  I
searched on "rpg edit code" (no quotes).

Having that to hand, we can scan down the 'Zero Balance' column and see that
edit code X does in fact leave all the zeroes in place, just as you like
(despite it's odd nomenclature.)  Zero Balance suppresses all zeroes but the
last (for a 0 decimal number).

So, you were in fact on the right track.  I would guess that the number of
different answers you got relate directly to the amount of detail in the
original question.  My post was more concerned with the idea that you might
be concatenating different sized numbers, which would be problematic if you
use an edit word.  By the bye, do you understand why the edit word didn't
work for you?  You were pretty close there too.

I was thinking about the possibility of a varied length number, but others
may think of the situation where the target is a different size, say 9
bytes.  Will you see trailing blanks, leading blanks or something else
altogether?  There's certainly nothing wrong with kicking the tires yourself
and see how the manual reference plays out in real life.  Here's some code
that compiles back at least to V4R4:

h debug
 * dbgview(*list)

d Alpha           s              2    inz('xx')
d Number          s              5s 0 inz(1234)
d AlphaNum        s              7
d AlphaNum9       s              9
d output          s             50

c                   eval      AlphaNum = Alpha + %editc(Number:'X')
c                   eval      output='*' + AlphaNum + '*'
c     output        dsply
c                   eval      AlphaNum = Alpha + %editc(Number:'3')
c                   eval      output='*' + AlphaNum + '*'
c     output        dsply
c                   eval      AlphaNum9 = Alpha + %editc(Number:'X')
c                   eval      output='*' + AlphaNum9 + '*'
c     output        dsply
c                   eval      *inlr = *on

Then there's the scenario when the target string is too small.  Of course,
if this is to replace a pair of lines with a single BIF, you may not care,
but remember that you asked the question to a LOT of people; and some of
them might not have your precise scenario.  Responders tend to try to make
the answer as generic as possible so that the answer will be good for many
readers.  In fact, this very thread is going to go into the archives at
http://archive.midrange.com/rpg400-l where it might be able to help somebody
in the future who hasn't started using RPG IV yet!

My point for posting this missive is to demonstrate some of the techniques
available to research a question, as well as some of the considerations a
responder thinks about and the 'kick the tires' method of trying stuff out.
  --buck


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.