Looks like OERUN is something I have a use for, but I find the documention rather sketchy.
First, what is the difference/usage of -c and -r ?
Now, if the routine I want to run is a function with more than one argument then how about an example in OERUN for:
Ans=MyFunction( argA, argB)
Where does the value of Ans go?
What if the routine to run is a subroutine with more than one argument then how about an example for:
Call MySubr( argC, argD)
What if the string for the "commandString" contains spaces? Can commandString be contained between quotes?
And, finally, what is the use of returning "results to the command line"? I thought this was executed in the OS, not in OI?
Dave (using oi 9.1.1)
OERUN -a -u -p -c
{-l } {-n } {-r }{-s } {-f } {-d }For Example:
OERUN -a SYSPROG -u SYSPROG -c GET_SYSINFO -e LOCALHOST -n 8088 -r GET_SYSINFO -f 65 -d 1
will execute the GET_SYSINFO command within SYSPROG and return the results to the command line.
Hi, Dave.
The best way to think of the "-r" parameter is to relate it to OECGI2/OECGI3. This is the "procedure name" that serves as the "dispatcher" for the command - just like, in OECGI2/OECGI3, we often specify RUN_OECGI_REQUEST as the procedure name.
The "-c" specifies the command to run; again, relating it back to OECGI2/OECGI3, it would be something like INET_TRACE.
Does that make it a bit clearer?
By default, OERUN's "dispatch" program is the same routine we use for CTO, so you can issue any CTO command and whatever output it produces will be what OERUN returns. Thus, the "-c" option could be:
-c TIME (to display the current time)
-c "COUNT CUSTOMERS" (to count the CUSTOMERS table)
-c "LIST CUSTOMERS FNAME LNAME" (to list the CUSTOMES table, showing the LNAME and FNAME columns - though of course you'll need to parse the output)
Now, the example assumes that you invoke OERUN from within a DOS command box in Windows; what we mean by "return the results to the command line" is that the output from OERUN is displayed on the DOS command line.
As you see from the above, the "-c" parameter can be quoted if it contains multiple space-delimited parameters.
Of course, the CTO dispatch routine might not be appropriate for you (though before you dismiss it, you may not realize that you can issue the same type of commands as you would to the System Monitor, minus the "RUN " part of the command, so maybe it _will_ do what you need). If it won't work for you, though, you might choose to write your own "dispatch" routine, which is very simple. You have 2 ways in which you can write your dispatcher:
1. As a function that takes a single parameter - the single parameter is what's passed in as the "-c" parameter on the invocation line. And whatever it returns as the result of the function is what OERUN displays as its result; or
2. As a stored procedure that takes a single parameter (again, the "-c" value) and returns whatever it wishes to be displayed in that same first parameter.
An example of approach #1 might be:
FUNCTION OERUN_DISPATCHER(CMD)
RETURN "YOU SAID *":CMD:"*"
While an example of approach #2 might be:
SUBROUTINE OERUN_DISPATCHER(PARAM1)
RESULT=YOU SAID *":PARAM1:"*"
PARAM1=RESULT
RETURN 0
(Though of course I do hope you'll do something more interesting with the passed-in values than I did here…)
By writing your own dispatcher, and specifying its name as the "-r" parameter on the invocation line, you have complete control over how you call…well, whatever it is that you would like OERUN to call.
Hope that helps,
- Bryan Shumsky
Revelation Software
And, since my last post didn't provide _all_ the information possible, I decided I have some more to add…
One thing to bear in mind is that OERUN was mostly designed as a way of "kicking off" a stored procedure (or function) that doesn't generate any output; most output from an OI stored procedure will be window-oriented, which isn't appropriate here.
If you're not that concerned about the output from your stored procedure, but are more interested in just kicking it off, you can still use the CTO "dispatch" routine even if your stored procedure takes multiple parameters. For the "-c" OERUN parameter, simply specify the name of the stored procedure you wish to run and the parameters it requires, comma-delimiting the parameters and quoting the whole string. For example:
-c "MYSUBR VALUE FOR ARGC,VALUE FOR ARGD"
The CTO dispatcher will parse that into the 2 parameters of your MySubr stored procedure. You can similarly call MyFunction (so long as you don't care about the result of the function call; the CTO dispatch routine will discard it). If you wanted your stored procedure to generate some response that the CTO dispatcher could "capture", and thus return to OERUN for display, you can use the DO_PRINT subroutine inside your stored procedure or function:
CALL DO_PRINT("Procedure call successful")
OK, _now_ I think I've answered all your questions (and then some!)
Bryan, thanks for the "meaty" response.
OERUN will indeed do what I want.
Dave