Hi,
Pls let me know how u handle negative values in natural for calculations
negative value in natural
-
- Posts: 35
- Joined: Wed Oct 08, 2008 11:39 am
- Skillset: cobol, dn2, jcl, adabas, roscoe
- Referer: FRIEND
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: negative value in natural
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
Regards
Nic
-
- Posts: 35
- Joined: Wed Oct 08, 2008 11:39 am
- Skillset: cobol, dn2, jcl, adabas, roscoe
- Referer: FRIEND
Re: negative value in natural
i had look at the manuals
to elaborate
can i move -234.5678 to N(999.9999).
pls explain
to elaborate
can i move -234.5678 to N(999.9999).
pls explain
- RGZbrog
- Posts: 101
- Joined: Mon Nov 23, 2009 1:34 pm
- Skillset: Natural, Adabas, Predict, Natural Security, Construct, EntireX, SPoD, NaturalONE
- Referer: SAG Developer Forum
- Location: California, USA
- Contact:
Re: negative value in natural
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.And here's the output.Notice that the field definition is N3.4; 3 digits before the implied decimal point, 4 digits after.
Code: Select all
DEFINE DATA LOCAL
1 #N (N3.4)
END-DEFINE
MOVE -234.5678 TO #N
WRITE '=' #N #N (EM=HHHHHHH)
END
Code: Select all
Page 1 12/14/15 00:47:05
#N: -234.5678 F2F3F4F5F6F7D8
-
- Posts: 35
- Joined: Wed Oct 08, 2008 11:39 am
- Skillset: cobol, dn2, jcl, adabas, roscoe
- Referer: FRIEND
Re: negative value in natural
thanks RGZgrog 

-
- Similar Topics
- Replies
- Views
- Last post
-
- 2
- 1567
-
by sergeyken
View the latest post
Sun Jan 26, 2025 3:07 am