# Interesting "Data Representation"

**URL:** <https://techcommunity.softwareag.com/t/interesting-data-representation/101774>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [November 20, 2012, 9:20pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774 "2012-11-20T21:20:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikolay\_Kuhta](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@Nikolay\_Kuhta](https://techcommunity.softwareag.com/u/Nikolay_Kuhta)\
**Post date:** [November 20, 2012, 9:20pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/1 "2012-11-20T21:20:50Z")

</div>

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

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

0010 DEFINE DATA LOCAL  
0020 1 #P1 (P3.4)  
0030 1 #N1-ALPHA (A07) INIT \<‘0391H00’\>  
0040 1 REDEFINE #N1-ALPHA  
0050 2 #N1-NUM (N3.4)  
0060 1 #RESULT (A10)  
0070 \*\*  
0080 END-DEFINE  
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:  
#P1#N1-NUM#RESULT

* * *

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  
MOVE EDITED #N1-NUM (EM=9(2)9.9999) TO #RESULT  
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.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [November 20, 2012, 9:41pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/2 "2012-11-20T21:41:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [November 20, 2012, 9:57pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/3 "2012-11-20T21:57:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Nikolay\_Kuhta](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@Nikolay\_Kuhta](https://techcommunity.softwareag.com/u/Nikolay_Kuhta)\
**Post date:** [November 20, 2012, 11:15pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/4 "2012-11-20T23:15:37Z")

</div>

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 🙂  
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 🙂  
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” 🙂

---

<div class="post-metadata">

**Author:** ![Jerome\_LeBlanc](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/jerome_leblanc/32/111_2.png) [@Jerome\_LeBlanc](https://techcommunity.softwareag.com/u/Jerome_LeBlanc)\
**Post date:** [November 20, 2012, 11:43pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/5 "2012-11-20T23:43:36Z")

</div>

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

```auto

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

---

<div class="post-metadata">

**Author:** ![Nikolay\_Kuhta](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@Nikolay\_Kuhta](https://techcommunity.softwareag.com/u/Nikolay_Kuhta)\
**Post date:** [November 21, 2012, 3:14pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/6 "2012-11-21T15:14:12Z")

</div>

Well, thank you very much 🙂

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [November 21, 2012, 4:56pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/7 "2012-11-21T16:56:03Z")

</div>

> [@Nikolay Kuhta](#):
>
> Is that “H” character on the alpha (A10) #RESULT field a digit? I’m still a bit confused 🙂

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.

---

<div class="post-metadata">

**Author:** ![Nikolay\_Kuhta](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@Nikolay\_Kuhta](https://techcommunity.softwareag.com/u/Nikolay_Kuhta)\
**Post date:** [November 21, 2012, 5:18pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/8 "2012-11-21T17:18:41Z")

</div>

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,  
NK

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [November 21, 2012, 9:26pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/9 "2012-11-21T21:26:00Z")

</div>

Nikolay,

you’ll have to [register to get access to empower](https://empower.softwareag.com/public_faq.asp#access1) in order to be able to file support incidents.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [November 22, 2012, 8:21am UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/10 "2012-11-22T08:21:33Z")

</div>

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

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

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

  39.1800 39.1H00 039.1800
```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:02pm UTC](https://techcommunity.softwareag.com/t/interesting-data-representation/101774/11 "2021-04-02T15:02:35Z")

</div>


