Interesting "Data Representation"

Hi guys,
I’m wondering whether it is “normal” (because so far I’m not sure about it) :slight_smile:

The program (Natural , mainframe env - very important: HEX ‘C8’ = Char (‘H’))

0020 1 #P1 (P3.4)
0030 1 #N1-ALPHA (A07) INIT <‘0391H00’>
0050 2 #N1-NUM (N3.4)
0060 1 #RESULT (A10)
0070 **
0090 #P1 := #N1-NUM
0100 MOVE EDITED #N1-NUM (EM=9(2)9.9999) TO #RESULT
0110 DISPLAY ‘=’ #P1 ‘=’ #N1-NUM ‘=’ #RESULT
0120 END

The output:

39.1800 39.1H00 039.1H00

My concern is mostly about the value of #RESULT; personally, I expected something more “digital” (or a run-time exception) after
Apparently, I should have used
MOVE EDITED #P1 (EM=9(2)9.9999) TO #RESULT to get the “more natural” 039.1800, but I’d like to hear from you anyway.

Many thanks in advance.

I seem to recall that this is as it always has been. When you redefine Alpha and Zoned Decimal, you must be careful, because Natural doesn’t care much about the leading nibble.

On the other hand, with Natural 6 (I don’t have mainframe access anymore) both #N1-NUM and #RESULT display properly.

I guess when applying an edit mask to a N field Natural assumes,
and it makes sense, that the data contained therein is ok, so only
the separators need to be inserted, no transformation takes place.

Well, I guess what Wolfgang means is “… when you put some garbage IN, you’ll get exactly the same “jewelry” OUT” :-), and I can’t disagree less with him :slight_smile:
However, I was able to execute “perfectly correctly” 2 more statements:

#P1 := #N1-NUM * 2
DISPLAY ‘=’ #P1 (this last one gives me 78.3600).
As such (I’m getting to the point :slight_smile:
39.1H * 2 = 78.36

To me, it’s a good illustration on the subject that “…there are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy” :slight_smile:

As Ralph said, you must be careful. Are you sure that you want to coerce a number out of garbage? You might be better off catching this exception with an edit mask or or “IS (N7)” before treating #N1-NUM as a number.

Consider what happens if #N1-ALPHA is initialized as:
1 #N1-ALPHA (A07) INIT <‘039100J’>

The output for your snippet is now

   #P1     #N1-NUM   #RESULT  
--------- --------- ----------
 -39.1001  -39.1001 039.1001  

Well, thank you very much :slight_smile:

Meanwhile (and I mentioned that in my first post),
"…My concern is MOSTLY about the value of #RESULT; personally, I expected something more “digital” (or a run-time exception) after
MOVE EDITED #N1-NUM (EM=9(2)9.9999) TO #RESULT "

Apparently, I did not get right the following (quote for Help from Natural 6.3)

Characters for the Definition of Numeric Edit Masks
Character Function
9 Position to be displayed (one digit of the field value).

Is that “H” character on the alpha (A10) #RESULT field a digit? I’m still a bit confused :slight_smile:

No, it (of course) isn’t, but Natural apparently doesn’t check if it is a valid numeric when applying the edit mask, as I tried to explain, no data transformation required throughout the process so there’s no step in the chain which would directly result in an exception.

It’s a case of GIGO (garbage in -> garbage out), I’d suggest filing a support incident.

Thank you, Wolfgang, I really appreciate your help.
Well, we have some people in our shop responsible for Adabas/Natural support, and I`m going to contact them.
By the way (this is rather out of curiosity), is there a way to “file a ticket” for “a mere mortal”?

Best regards,


you’ll have to register to get access to empower in order to be able to file support incidents.

BTW: The output on Nat6.3@Solaris is:

Page      1                                                  12-11-22  08:27:54

   #P1     #N1-NUM   #RESULT
--------- --------- ----------

  39.1800   39.1H00 039.1800