# Obfuscated Natural ...

**URL:** <https://techcommunity.softwareag.com/t/obfuscated-natural/172644>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Linux\
**Created:** [September 19, 2013, 4:24pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644 "2013-09-19T16:24:24Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [September 19, 2013, 4:24pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/1 "2013-09-19T16:24:24Z")

</div>

Hello all,

just for fun. Please complete the following Natural code by writing the data definition:

```auto
define data local
... 
end-define
for for eq to to step step to
write edited (EM=-ZZ9) to step
end-for
end
```

The Output of the program is:

```auto

Page 1 13-09-19 16:22:26
   1 1 2
   2 1 2

More
```

😉

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [September 19, 2013, 6:09pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/2 "2013-09-19T18:09:00Z")

</div>

```auto
DEFINE DATA LOCAL
1 FOR (N3)
1 REDEFINE FOR
  2 EDITED (N3)
1 TO (N3) CONST<1>
1 STEP (N3) CONST<2>
END-DEFINE
```

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [September 19, 2013, 6:11pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/3 "2013-09-19T18:11:21Z")

</div>

Funny when you STRUCT it…

```auto
0010 DEFINE DATA LOCAL                       
0020 1 FOR (N3)                              
0030 1 REDEFINE FOR                          
0040 2 EDITED (N3)                         
0050 1 TO (N3) CONST<1>                      
0060 1 STEP (N3) CONST<2>                    
0070 END-DEFINE                              
0080 *                                       
0090 FOR FOR EQ TO TO STEP STEP TO           
0100 WRITE EDITED (EM=-ZZ9) TO STEP      
0110 END-FOR                               
0120 END                                     
```

Runtime:

```auto
MORE 	                                                                          
Page 1 13-09-19 12:11:52
                                                                               
   1 1 2 	                                                                
   2 1 2 	                                                                
                                                                               
```

---

<div class="post-metadata">

**Author:** ![Todd\_Beckwith](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/todd_beckwith/32/388_2.png) [@Todd\_Beckwith](https://techcommunity.softwareag.com/u/Todd_Beckwith)\
**Post date:** [September 19, 2013, 6:22pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/4 "2013-09-19T18:22:55Z")

</div>

That was strangely fun. Glad I didn’t notice Brian beat me to the answer else I probably wouldn’t have worked at figuring it out. I failed to look at the spaces between columns. I think Brian’s N3s are more accurate than my I4s would have been, though Brian’s output seems to suggest his runtime results were not using the N3. I found the same struct problem on v6.3.12 on HP UX .

```auto
DEFINE DATA LOCAL       
1 TO (I4) INIT <1>
1 STEP (I4) INIT <2>
1 FOR (I4)         
1 REDEFINE FOR          
  2 EDITED (I4)         
END-DEFINE              
```

---

<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:** [September 20, 2013, 9:41am UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/5 "2013-09-20T09:41:55Z")

</div>

Obviously you can gain even more obfuscation using struct 😉

How about this one:

```auto
define data local
01 for (I1)
01 redefine for
  02 edited(I1)
01 to (I1) init <1>
01 step(I1) init <2>
end-define
for
  for eq to to step step to write edited (EM=-ZZ9) to step
  end-for
end
```

---

<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:** [September 20, 2013, 9:40pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/6 "2013-09-20T21:40:59Z")

</div>

This is why KCHECK=ON should be the default setting in NatParms. Of course you still would have to look for overrides (during code walkthroughs) to stop programmers from cheating.

```auto
OPTIONS KCHECK=OFF
DEFINE DATA LOCAL  
1 FOR (I1) 1 REDEFINE FOR
  2 EDITED (I1)
1 TO (I1) INIT <1>
1 STEP (I1) INIT <2>
END-DEFINE
FOR
  FOR EQ TO TO STEP STEP TO WRITE EDITED (EM=-ZZ9) TO STEP
END-FOR
END
```

---

<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:** [September 25, 2013, 11:48am UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/7 "2013-09-25T11:48:42Z")

</div>

> [@Ralph Zbrog](#):
>
> This is why KCHECK=ON should be the default setting in NatParms.

PCHECK is another interesting parameter. But we got some trouble with catall with this both parameters set to ON. Natural crashes with coredump.

It is planned to upgarde to the latest natural version the next few months. Let’s see…

---

<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:** [September 25, 2013, 4:34pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/8 "2013-09-25T16:34:58Z")

</div>

Hi Matthias,  
I suspect that after your post (and upgrading to the latest Natural release 🙂 you will read something like this from the Natural documentation:

“Here is a list of keywords in the Natural programming language. You cannot use any of the following as identifiers in your programs: …” 🙂

---

<div class="post-metadata">

**Author:** ![Mick\_Fitzpatrick](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Mick\_Fitzpatrick](https://techcommunity.softwareag.com/u/Mick_Fitzpatrick)\
**Post date:** [September 25, 2013, 5:49pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/9 "2013-09-25T17:49:24Z")

</div>

The weird thing is that the compiler Nat 4.2.6 on zOS at least will catch some things but not others. Your example stowed fine for me - I even called the program PROGRAM - and this example also works

```auto

DEFINE DATA LOCAL         
1 EQ (A2)                 
1 THEN (A2) INIT <'IF'>   
END-DEFINE                
INPUT EQ                  
IF THEN EQ EQ             
  WRITE '='               
END-IF                    
END                       
```

but each part of this one fails - as you cannot INPUT INPUT or WRITE WRITE let alone IF IF

```auto

INPUT INPUT            
IF IF EQ EQ            
  WRITE WRITE          
```

---

<div class="post-metadata">

**Author:** ![Mick\_Fitzpatrick](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Mick\_Fitzpatrick](https://techcommunity.softwareag.com/u/Mick_Fitzpatrick)\
**Post date:** [September 25, 2013, 8:07pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/10 "2013-09-25T20:07:03Z")

</div>

Or how about these few statements which will also compile and execute provided you have the data areas to match

```auto

MOVE MOVE TO TO                                                   
EXAMINE EXAMINE FOR GIVING GIVING POSITION POSITION
DIVIDE SUBTRACT INTO ADD REMAINDER MULTIPLY                   
```

Maybe SAG should start a competion to see who can code the weirdest application of unintelligible code that actually runs

---

<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:** [September 25, 2013, 10:36pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/11 "2013-09-25T22:36:28Z")

</div>

Sorry, this is “the serious part” which I’ve missed in my previous message.  
Well, it is still optional ((KCHECK) Keyword checking … OFF) “feature” of our Natural 8.2.2.3. If it were within my power, I think I’d rather removed this altogether - what`s the reason to keep it “optional”? The good program should be simple and clear

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [September 25, 2013, 11:04pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/12 "2013-09-25T23:04:22Z")

</div>

I understand the need for having options because there could be issues if existing code breaks. I would tighten enforcement up in development but leave it open in production until I was sure the bad code was fixed.

We’re on Natural 4.2.7 so this is something I will need to handle the next upgrade.

In the meantime, this challenge was fun!

---

<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:** [September 26, 2013, 6:05pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/13 "2013-09-26T18:05:40Z")

</div>

Can’t disagree less with Brian: the challenge was VERY fun! 🙂 Many thanks to Matthias indeed

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [September 27, 2013, 3:33pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/14 "2013-09-27T15:33:40Z")

</div>

Every programming language has strange syntax and naming conventions. Personally, I think reserved words should never be permitted as variable names. However, as Brian noted, this could cause problems when new reserved words might be added to the language and existing programs suddenly fail.

Here is one of my favorite Natural Syntax anomalies: (use SAG’s employees demo file)

DEFINE DATA LOCAL  
1 MYVIEW VIEW OF EMPLOYEES  
2 NAME  
2 FIRST-NAME  
2 CITY  
2 COUNTRY  
END-DEFINE  
\*  
READ MYVIEW BY NAME FIRST-NAME CITY  
DISPLAY _COUNTER NAME FIRST-NAME CITY  
END-READ  
\*  
\*\* WRITE T_NAME NAME FIRST-NAME CITY / T\*CITY ‘LOOK AT THE VALUE OF CITY’  
\*  
END

Questions:

1. Will this program Check?

2. Will it Run?

3. If it runs, what will it be doing?

4. If it runs, explain the output.

5. If it runs, why does the output end where it does?

6. If stuck on last question, uncomment the WRITE statement and re-run.

enjoy.

---

<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:** [October 1, 2013, 10:36am UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/15 "2013-10-01T10:36:27Z")

</div>

1. Yes, it checks.
2. Yes, it runs.
3. I would expect the following: Display all Employees with empty NAME since the fields in the from-to-clause (i.e. first-name and city) are empty at the beginning.
4. We got no employees file at our test system… ☹ Let me see what I can do.

---

<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:** [October 1, 2013, 10:41am UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/16 "2013-10-01T10:41:46Z")

</div>

We only got the SAGTOURS-File on our test Database…

BTW: NAME is a reserved keyword.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [October 1, 2013, 11:53am UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/17 "2013-10-01T11:53:21Z")

</div>

Hi Matthias;

Answers 1) and 2) are, of course correct. That was the real objective of the example, to point out that the words “starting from” and “to” are unnecessary. This can be very confusing. Some people look at the statement and think that they can read logical by three fields.

However, you really need a file to properly answer the rest of the questions. There are no records with blank names; but, there is quite a bit of output.

Do you have an old Personnel file around?

Or do you have Natural on the PC, which has the same employees file?

steve

---

<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:** [October 1, 2013, 4:23pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/18 "2013-10-01T16:23:15Z")

</div>

I got Natural+Adabas@Solaris with SAG-TOURS-File.  
I also got Natural@Win. There’s the employee DDM but no ADABAS.

How about posting the output here?

---

<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:** [October 1, 2013, 4:32pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/19 "2013-10-01T16:32:48Z")

</div>

> [@Nikolay Kuhta](#):
>
> “Here is a list of keywords in the Natural programming language. You cannot use any of the following as identifiers in your programs: …” 🙂

[http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat6314win/pg/pg\_keyw.htm#pg\_keyw](http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat6314win/pg/pg_keyw.htm#pg_keyw)

---

<div class="post-metadata">

**Author:** ![Mick\_Fitzpatrick](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Mick\_Fitzpatrick](https://techcommunity.softwareag.com/u/Mick_Fitzpatrick)\
**Post date:** [October 1, 2013, 5:08pm UTC](https://techcommunity.softwareag.com/t/obfuscated-natural/172644/20 "2013-10-01T17:08:24Z")

</div>

Does anyone know of a link to a list of currently and actually reserved keywords.

[Next page](https://techcommunity.softwareag.com/t/obfuscated-natural/172644.md?page=2)
