|
Yes, using overlay is the best choice and I normally use this approach.
But sometime I ran into a situation where the char7 field is actually
comes from a file and I've read the file to the result-ds (likerec). In
this case, I etiher perform the %dec calculation or use base pointer to
achieve the overlay. So...I still miss that move feature....
"Barbara Morris" <bmorris@xxxxxxxxxx> wrote in message
news:mailman.17576.1291321252.2702.rpg400-l@xxxxxxxxxxxxxxx
On 12/2/2010 2:35 PM, hockchai Lim wrote:
...
Now look at the code below. The value of the rate would be 12345.67,
which
is what I wanted, after executing the MOVE statement.:
D char7 S 7a inz('1234567')
D rate S 7 2
C move char7 rate
In that MOVE, your char7 is actually being interpreted as a zoned-decimal
value. Say char7 was '123456N', you would get -12345.65 in your rate
field.
I think it would be much better to be explicit about what is happening,
by using a data structure that describes the nature of char7:
D ds
D char7 7a inz('1234567')
D char7num 7s 2 overlay(char7)
D rate S 7 2
C eval rate = char7num
Arguably that is easier to understand than using %SUBST or %INT with
division.
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.