Invoking an OpenInsight routine from the DOS command line using the OERUN executable (Functions/Subroutines/Programs,General)

OERUN allows you to invoke an OpenInsight routine from the DOS command line.  This is useful any time you need to have a Windows routine (such as a batch file, or the scheduled task manager) invoke an OpenInsight stored procedure.  OERUN will connect to the Engine Server, start up an OEngine in the specified application, run the stored procedure, and then terminate; any output from the stored procedure will be returned to the DOS command line (where it may be displayed, or "redirected" to a DOS file).

 

Syntax: OERUN -a <appname> -u <username> -p <password> -c <commandString>

            {-e <engineserverURL>} {-n <engineserverPort>} {-r <routineName>}

            {-s <engineName>} {-f <startupFlags>} {-d <shutdownFlags>}

 

 

Parameters:      <appname> - name of application where the stored procedure should be run

                        <username> - name of user required to log in to the desired application

                        <password> - password for the user to log in to the desired application

                        <commandString> - stored procedure name (and any parameters) to be run

                        <engineServerURL> (optional) - URL where the engine server is running (default: LOCALHOST)

                        <engineServerPort> (optional) - TCP/IP Port Number where the engine server is listening (default: 8088)

                        <routineName> (optional) - "Listener" routine that will process the request (default: DO_CTO)

                        <engineName> (optional) - Name of engine to create or connect to (default: \.\OERUN)

                        <startupFlags> (optional) - Startup flags to use when creating the engine (default: 65)

                        <shutdownFlags> (optional) - Shutdown flags to use when creating the engine (default: 1)

 

Notes:

 

The default "listener" routine (DO_CTO) will invoke the specified stored procedure (as passed via the "-c" parameter) as though it were a CTO/AREV32 command; the output that will be returned is any "printed" output (using the CTO or AREV32 "PRINT" statement).  This is sufficient to run any stored procedure that needs to "do something" (not just a CTO or AREV32 routine, but any OpenInsight stored procedure), if the actual output is not important.

 

Alternatively, you can specify a listener routine (via the "-r" parameter) that you create yourself; this routine should be an OpenInsight function that does NOT generate any Windows GUI output.  The value returned by this function will be the returned output.  Any parameter you wish to pass in to your listener will then be specified with the "-c" parameter.

 

Examples:

C:\RevSoft\OpenInsight> OERUN -a SYSPROG -p SYSPROG -u SYSPROG -n 8089 -c DATE P? 27 FEB 2009X>

 

C:\RevSoft\OpenInsight> OERUN -a SYSPROG -u SYSPROG -p SYSPROG -n 8089 -c "COUNT VOC"

P? 296 items counted

 

C:\RevSoft\OpenInsight> OERUN -a SYSPROG -u SYSPROG -p SYSPROG -n 8089 -c "LIST 30 VOC" > temp.txt

 

Given a stored procedure named MYLISTENER, defined as follows:

FUNCTION MYLISTENER(P1)

If Assigned(P1) Else P1 = ""

Return  "You said *":p1:"*":@FM:"1":@FM:"2":@FM:"3"

 

C:\Revsoft\OpenInsight> OERUN -a SYSPROG -u SYSPROG -p SYSPROG -n 8089 -r MYLISTENER -c "HELLO WORLD"

You said *HELLO WORLD* 1 2 3

  • kb/kb_articles/kb1000.txt
  • Last modified: 2024/01/30 13:36
  • by 127.0.0.1