07-11-2006 9:28 PM
Hello there,
I was trying to convert an integer of type n to type i, however, when i do
data: foo_of_type_i type i.
foo_of_type_i = foo_of_type_n.
foo_of_type_i becomes type n as well and therefore I can not compare foo_of_type_i to other integers of type i.
Any suggestions?
Thanks a lot!
Regards,
Anyi
07-11-2006 9:32 PM
TYPe N fields are zero filled left, TYPE I is not, so when moving from type N to TYPE I, it will convert from 0001 to 1. Then you can compare the value of "1".
data: foo_of_type_i type i.
data: foo_of_type_n type n value '0001'.
foo_of_type_i = foo_of_type_n.
if foo_of_type_i = '1'.
write:/ 'the value is one'.
endif.
Regards,
Rich Heilman
07-11-2006 9:32 PM
TYPe N fields are zero filled left, TYPE I is not, so when moving from type N to TYPE I, it will convert from 0001 to 1. Then you can compare the value of "1".
data: foo_of_type_i type i.
data: foo_of_type_n type n value '0001'.
foo_of_type_i = foo_of_type_n.
if foo_of_type_i = '1'.
write:/ 'the value is one'.
endif.
Regards,
Rich Heilman