Page 1 of 1

negative value in natural

PostPosted: Sun Dec 13, 2015 6:20 pm
by mainframe1
Hi,
Pls let me know how u handle negative values in natural for calculations

Re: negative value in natural

PostPosted: Sun Dec 13, 2015 6:40 pm
by NicC
You should have the manuals available to you so refer to them. Also, look at other programs and see how they deal with them.

Re: negative value in natural

PostPosted: Sun Dec 13, 2015 7:02 pm
by mainframe1
i had look at the manuals

to elaborate
can i move -234.5678 to N(999.9999).
pls explain

Re: negative value in natural

PostPosted: Mon Dec 14, 2015 2:24 pm
by RGZbrog
Natural processes external decimal (format N) values just like any other mainframe language would. That is, the right-most byte contains the sign in the left nibble. Here's some code to demonstrate.
DEFINE DATA LOCAL
1 #N (N3.4)
END-DEFINE
MOVE -234.5678 TO #N
WRITE '=' #N #N (EM=HHHHHHH)
END
And here's the output.
Page     1                                                   12/14/15  00:47:05
 
#N: -234.5678 F2F3F4F5F6F7D8
Notice that the field definition is N3.4; 3 digits before the implied decimal point, 4 digits after.

Re: negative value in natural

PostPosted: Mon Dec 14, 2015 5:28 pm
by mainframe1
thanks RGZgrog :)