Barbara,
That is true, but the MOVE would let me move ABC and get 123.
---- Ducking for cover ----
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions
Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical
Solutions Implementer V5R3
________________________________
From: Barbara Morris <bmorris@xxxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxx
Sent: Thu, December 2, 2010 3:40:51 PM
Subject: Re: Moving a field and removing blanks
On 12/2/2010 3:23 PM, hockchai Lim wrote:
nah, I trust Barbara's coding skill a bit better than my own. Plus, she can
probably comes up with something that is really easy to use like "rate =
%move(char7)", which I won't be able to do if I would have to create one on
my own.
I completely agree with Brian on this.
If it is really common for you to have strings of digits that you want
to interpret as values with decimal places, then write a procedure like
this, that returns some size of packed value that will handle all your
needs, say a 63,15 packed value:
getDecVal(string : number_of_decimals);
Input: '12345' 2 Returns: 123.45
Input: '1234N' 3 Returns: -12.345
It might not be particularly easy to write, but once it is written, you
are done forever, and your code will be much clearer than it would have
been with the MOVE opcode.
rate = %getDecVal(char7 : 2);
As an Amazon Associate we earn from qualifying purchases.