blank in a numeric field



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

blank in a numeric field

Postby alex65 » Mon Jun 19, 2017 1:20 pm

Hello
Why Natural treets a blank in a numeric field like a zero value?!

DEFINE DATA
LOCAL
1 #F (N3)
1 REDEFINE #F
2 #N1 (N1)
2 #A2 (A1)
2 #N3 (N1)
END-DEFINE
#N1:= 1
RESET #A2
DISPLAY #F
IF #F = 100
WRITE '!!!' '=' #F
END-IF
#F := #F * 2
DISPLAY #F
END

#F
----

1 0
!!! #F: 1 0
200

Thanks
alex65
 
Posts: 1
Joined: Mon Jun 19, 2017 1:02 pm
Has thanked: 0 time
Been thanked: 0 time

Re: blank in a numeric field

 

Re: blank in a numeric field

Postby Robert Sample » Mon Jun 19, 2017 7:17 pm

It depends upon what Natural does internally. If numeric values are converted from zoned decimal to packed decimal for operations, then blanks are X'40' and the first 4 bits (the zone) will be ignored and only the second 4 bits will be treated as the value -- and since a zero is X'F0' you cannot tell the difference between a blank and a zero once the value is packed.
Robert Sample
Global moderator
 
Posts: 3345
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 219 times


Return to Natural

 


  • Related topics
    Replies
    Views
    Last post