×
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.
Hi Robert -
I have to blocks of code that do the exact same thing(I think), one uses
2 steps the other does it all in one line. The 2 step example works,
the 1 line does not.
os400 = v5r2m0
parms.transNo is 10A
transNo is 10A
wrk is 10S0
2 steps:
wrk = (%dec(transNo:%size(transNo):0) + 1);
parms.transNo = %editc(wrk:'X');
1 step:
parms.transNo = %editc%dec(transNo:%size(transNo):0) + 1:'X');
Rick has the correct answer, that the compiler is sizing the intermediate
field bigger than what you expected.
You can use %DEC a second time to force the field to the size you
want. Notice that I used the size of parms.transNo so that if transNo and
parms.transNo happen to have different sizes, the code will still work
correctly.
parms.transNo = %editc(%dec(%dec(transNo:%size(transNo):0) +
1:%size(parms.transNo):0):'X');
Another option would be to use your code, but with evalr rather than the
implied eval, however that method would not let you know if you have a
field overflow. With this method you will get a halt if the incremented
number will not fit into parms.transNo.
Ken
http://www.ke9nr.net/
Opinions expressed are my own and do not necessarily represent the views of
my employer or anyone in their right mind.
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
copyright@midrange.com.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.