negative value in natural



Software AG's platform-independent programming language with full support for open-source and Internet applications

negative value in natural

Postby mainframe1 » Sun Dec 13, 2015 6:20 pm

Hi,
Pls let me know how u handle negative values in natural for calculations
mainframe1
 
Posts: 35
Joined: Wed Oct 08, 2008 11:39 am
Has thanked: 0 time
Been thanked: 0 time

Re: negative value in natural

Postby NicC » Sun Dec 13, 2015 6:40 pm

You should have the manuals available to you so refer to them. Also, look at other programs and see how they deal with them.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3026
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: negative value in natural

Postby mainframe1 » Sun Dec 13, 2015 7:02 pm

i had look at the manuals

to elaborate
can i move -234.5678 to N(999.9999).
pls explain
mainframe1
 
Posts: 35
Joined: Wed Oct 08, 2008 11:39 am
Has thanked: 0 time
Been thanked: 0 time

Re: negative value in natural

Postby RGZbrog » Mon Dec 14, 2015 2:24 pm

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.
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time

Re: negative value in natural

Postby mainframe1 » Mon Dec 14, 2015 5:28 pm

thanks RGZgrog :)
mainframe1
 
Posts: 35
Joined: Wed Oct 08, 2008 11:39 am
Has thanked: 0 time
Been thanked: 0 time


Return to Natural

 


  • Related topics
    Replies
    Views
    Last post