# Dynamic Natural code

**URL:** <https://techcommunity.softwareag.com/t/dynamic-natural-code/60250>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Linux\
**Created:** [October 11, 2005, 6:52pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250 "2005-10-11T18:52:10Z")\
**Posts on this page:** 18\
**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:** [October 11, 2005, 6:52pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/1 "2005-10-11T18:52:10Z")

</div>

Hello Forum!

Is it possible to run a “dynamic” Natural Code on Linux? Example: I want to call about 60 Database-Server running ADABAS/NATURAL and run some Natural-Code. This should happen in batch-mode. It is an easy thing to contact all Computer via Linux-rsh and to start an existing Natural-Programm by putting it on the stack.

But is it possible to write a new program just before starting it? I thought about putting the code itself on the stack but now I think this is not a good idea…

Regards,

Matthias

---

<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:** [October 11, 2005, 7:10pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/2 "2005-10-11T19:10:33Z")

</div>

I think that it would be possible. You only have to write a Programm that gererates the dynamic programs.

Have a look at:

```auto

DEFINE PRINTER (1) OUTPUT 'SOURCE'
```

Then you could write programms to Editor pane with ‘WRITE (1) NOTITLE NOHDR’. There is also an Userexit to Stow a new Program. If i find it again i write it here in.

This Code would also be interesting:

```auto

SET CONTROL '.P'
SET CONTROL '.P'
MOVE 'SET TYPE P' TO #CMD
STACK TOP DATA #CMD
STACK TOP DATA 'SYSFULL' 'SYSLIB'
STACK TOP COMMAND 'E'
```

Greetings  
Sascha Wiegandt

---

<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:** [October 11, 2005, 7:37pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/3 "2005-10-11T19:37:08Z")

</div>

USR2019N would the right Userexit to Stow a Program.

---

<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 11, 2005, 8:03pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/4 "2005-10-11T20:03:14Z")

</div>

Sorry. I did my post into the Mainframe-Forum again! I should know: Linux is an open System. :oops:

Thanks for your answer. I’ll try it out later.

But would it be possible to write a program by putting “e p” and then an “r” on the stack?

---

<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 11, 2005, 8:11pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/5 "2005-10-11T20:11:15Z")

</div>

> [@Wiegandt](#):
>
> Have a look at:
> 
> ```auto
> 
> DEFINE PRINTER (1) OUTPUT 'SOURCE'
> ```

Interesting thing. But I’m not sure if this helps. If I understand you correctly, I have to spread a “source-printer-program” over 60 Computer before I’m able to do anything…

---

<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:** [October 11, 2005, 8:15pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/6 "2005-10-11T20:15:56Z")

</div>

Oh i see i tried everything on Mainfraime. So i couldn’t say if it would also run on Natural for Linux.

---

<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:** [October 11, 2005, 8:26pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/7 "2005-10-11T20:26:40Z")

</div>

The 2nd Set Control Statement Block at my first post is the Same if you type ‘e p’ but don’t know i it’s possible to Stack ‘r’.

Aren’t the 60 Computers use the same Natural Database like on Mainframe?

---

<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 11, 2005, 8:45pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/8 "2005-10-11T20:45:48Z")

</div>

> [@Wiegandt](#):
>
> Aren’t the 60 Computers use the same Natural Database like on Mainframe?

The truth is: I don’t know much about Mainframes. I’m only dealing with Linux at the moment. :oops: So I hope one of the forum-administrators will move my post to the open-system-forum. Sorry again for that…

But anyway: I found a way that works on Linux.

1. transfer the needed code via ftp to a temporary directory on the target computer
2. copy the temporary source to a library
3. run ftouch with the new source
4. run natural  
Here’s my script:

```auto
cp /tmp/NATTEST.NSP /sag/nat/fuser/LIBRARY/SRC
cd /sag/nat/fuser/LIBRARY
ftouch fuser=100,102 sm -s NATTEST.NSP
natural batch parm=natparm bp=natbp stack="(logon library;run NATTEST;fin)"
```

But this is not really “dynamic”. So I’m still looking for a better solution.

---

<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:** [October 11, 2005, 8:55pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/9 "2005-10-11T20:55:58Z")

</div>

Why don’t use ‘patch’ or ‘ant’ or something else after transfering the Code? Then you only have to compile the new Object at the Targetmachine.

---

<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 11, 2005, 8:58pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/10 "2005-10-11T20:58:46Z")

</div>

> [@Wiegandt](#):
>
> Why don’t use ‘patch’ or ‘ant’ or something else after transfering the Code?

Sorry, but what is “ant”?

---

<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:** [October 11, 2005, 9:09pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/11 "2005-10-11T21:09:16Z")

</div>

[ant](http://ant.apache.org/) is a xml-based script-languange from Apache Groupe something like make but more powerful. Normaly used at Java Projects but it’s possible to use it also for other languages.

---

<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 11, 2005, 9:39pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/12 "2005-10-11T21:39:28Z")

</div>

> [@Wiegandt](#):
>
> [ant](http://ant.apache.org/) is a xml-based script-languange from Apache Groupe something like make but more powerful. Normaly used at Java Projects but it’s possible to use it also for other languages.

Hmmm. OK. I got a bit more than 60 Computers with Natural for Linux. Everyone has an own ADABAS-Database installed. I got one Communication-computer (UNIX) which can do a telnet, ftp or rsh (Remote-Shell) to all of these 60 Servers.

My problem is, that I want to do checkings on the Database and the Natural-Environment (to test, if everything is OK). This includes for example some ADABAS-reports (adarep). This works perfectly with a Shell-Script on the communication server. But now I want to add some NATURAL-Checks to that script.

At the moment it’s difficult for me to see, how ant/patch could help me…

---

<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:** [October 12, 2005, 6:16pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/13 "2005-10-12T18:16:24Z")

</div>

If i would have the same Problem i would write a Naturalprogramm with Tags that i would spread to all 60 Computers. At the Servers i would change the Tags to individual Code segments with patch or ant to that Code i need on this Machine. Then the last Problem is to Compile the Programm and run it.

A Example i want to tell is following:

You would start at each Computer a Adabas read but on each Computer the DDM-Name would change an have some type of Computername in its description. (A Bad Example but i think this could descripe what i mean) So you have to write following Program:

```auto

DEFINE DATA
LOCAL
01 MY-DDM VIEW OF @TO_CHANGE_WITH_ANT@
  02 ATTRIBUTE1
END-DEFINE
READ MY-DDM BY DESCRIPTOR-A
  PRINT(1) ATTRIBUTE1 '<-- Looks like i could read from DB'
END-READ
ON ERROR
  print(1) *MACHINE-CLASS ' - ' *OPSYS ' <-- have a Problem with ADABAS'
  ESCAPE ROUTINE
END-ERROR
```

At your Patch/Ant Script you change on each machine the Tag ‘@TO\_CHANGE\_WITH\_ANT@’ with that codesegment you want.

---

<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 13, 2005, 2:45pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/14 "2005-10-13T14:45:21Z")

</div>

> [@Wiegandt](#):
>
> At your Patch/Ant Script you change on each machine the Tag ‘@TO\_CHANGE\_WITH\_ANT@’ with that codesegment you want.

I think I understand your solution. On Linux I would do that with the stream editor sed…

Maybe your solution is independent from the System you are working on. I guess my one is only working on Linux. BTW: Have you got an ftouch on Mainframe?

---

<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:** [October 13, 2005, 3:47pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/15 "2005-10-13T15:47:57Z")

</div>

> [@Matthias](#):
>
> BTW: Have you got an ftouch on Mainframe?

ftouch isn’t required on mainframes because NATURAL objects are kept in a database rather than the file system.

---

<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:** [October 13, 2005, 3:48pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/16 "2005-10-13T15:48:38Z")

</div>

Don’t know if ftouch is on Mainframe but on PC i found it at SPoD. Didn’t know this utlility until you mentioned it 😃 Is it right that i could change Programs on Filesystem and then only have to use ftouch so the fuser will be syncronized with that changed program?

---

<div class="post-metadata">

**Author:** ![anon29934956](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@anon29934956](https://techcommunity.softwareag.com/u/anon29934956)\
**Post date:** [October 13, 2005, 4:35pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/17 "2005-10-13T16:35:10Z")

</div>

Yes. Please try ftouch -h for a very short help.

---

<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, 2:40pm UTC](https://techcommunity.softwareag.com/t/dynamic-natural-code/60250/18 "2021-04-02T14:40:19Z")

</div>

Closed on April 2, 2021, 2:40pm UTC


