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