Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Convert type n to type i

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

1 REPLY 1

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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