Dynamic Natural code

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…



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

Have a look at:


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:


Sascha Wiegandt

USR2019N would the right Userexit to Stow a Program.

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?

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…

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

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?

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:
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.

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.

Sorry, but what is “ant”?

ant 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…

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:

  PRINT(1) ATTRIBUTE1 '<-- Looks like i could read from DB'
  print(1) *MACHINE-CLASS ' - ' *OPSYS ' <-- have a Problem with ADABAS'

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?

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

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 :smiley: 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?

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