Executing Natural programs via task scheduler in a windows environment

Hi,

Our DBA recently resigned and I was thrown into the deep end taking over his responsibilities with about 2 weeks in house training.

I must execute a Natural program through task scheduler in a Natural 8.3.4 environment. There is 1 task running like that and I’ve tried to recreate it as best I could but mine is not working.

My Natural program name is ‘HELLO’.

I have created a batch file called hello.bat with the following command:
“C:\SoftwareAG\Natural\Bin\natural.exe” batchmode parm=HELLO

I have created the txt file called HELLOBATCH.txt with the following command:
LOGON TRACTMP (this is where my production db lives)
EXECUTE HELLO
FIN

My task in the scheduler ‘Action’ is: Start a program “d:\Production scripts\HELLO.bat (both the .bat and the .txt files lives here)

But something must be missing.
Is there somewhere in Natural whereI must create a ‘link’ between the .bat file and the .txt file? How does Natural/task scheduler know that it must also take the .txt file, with the logon command, into account when executing the task? It is as if the scheduler don’t really execute the natural program although it says ‘TASK executed’.

Please help

Welcome to the world of Adabas Database Administration! :slight_smile:

This, a webMethods forum, is not the place to post Adabas-related questions. If my answer doesn’t meet your needs, please re-post on Natural on Open Systems. You’re sure to get additional responses there.

If your HELLO program looks like this

WRITE 'Hello!'
END

then here is a working script. It’s the shotgun approach: verbose and explicit. My text file is called C:\SoftwareAG\batch\HelloBat.in. CMSYNIN refers to standard input.

@echo off
setlocal

C:\SoftwareAG\Natural\Bin\natural.exe batchmode parm=zbrog-c mainpr=01 cmsynin="C:\SoftwareAG\batch\HelloBat.in" cmobjin="C:\SoftwareAG\batch\HelloBat.in" cmprint="C:\SoftwareAG\batch\HelloBat.cmprint.txt" cmprt01="C:\SoftwareAG\batch\HelloBat.cmprt01.txt" natlog=all

A more readable version is

@echo off
setlocal

set cmsynin=Hello-Batch.in
set cmprint=Hello-Batch.cmprint.txt
set cmprt01=Hello-Batch.cmprt01.txt

echo logon zbrog   > %cmsynin%
echo hello        >> %cmsynin%
echo fin          >> %cmsynin%

C:\SoftwareAG\Natural\Bin\natural.exe batchmode parm=zbrog-c mainpr=01 cmsynin=%cmsynin% cmobjin=%cmsynin% cmprint=%cmprint% cmprt01=%cmprt01% natlog=all

del %cmsynin%

As a rule, I code my “control cards” in stream; I use text files for Production scripts.

I always code NATLOG=ALL so that Natural reports whether he executed normally or ABENDed.

I always code MAINPR to separate Natural’s audit trail (CMPRINT) from my report (CMPRT01).

The trickiest bit is PARM=ZBROG-C. You specified PARM=HELLO. This parameter names a Natural configuration file. It must exist, and its contents may cause your Natural execution to fail (due to parameter conflicts). Execute natparm.exe to view, create, and update parameter files.

Good luck to you.

ps Post follow-up questions on Natural on Open Systems.