Optional parameter - hide the window of the program
you want to run.
SYNC
in
Synchronous program run (waiting for termination).
ASYNC
in
Asynchronous program run.
paramExpr_Str
in
Expression
of String type, the result value of which will
create parameters of the running program.
TIMEOUT timeoutExpr_Int
in
Expression of
Int type -the
maximum program running time [s].
_toExec
in
Identifier of text type.
Description
The RUN action will run the program determined by text string "program
name". RUNEX action will run the program determined by value of
identifier of text type _toExec.
In the first type of
the declaration, it is able to specify whether the program will be run
synchronously (SYNC), or asynchronously (ASYNC). The second
type is always asynchronous. After the program termination, its return
code is assigned to the identifier of Int type.
If the maximal program running time is limited by the keyword TIMEOUT
and the program is not to be terminated in this time limit, the program
is to be terminated and the program and the return value (for the first
type) gets the value _ERR_TIME_OUT.
In some cases, the parameter program name must be created on the
basis of text operations. It is recommended to use RUNEX action to run
program determined by value of text identifier _toExec. The same result is reached by RUN action but the program name must
be an empty text string and whole command is to be declared as parameter
using the expression
paramExpr_Str (see the example below).
If RUN action is used with the return code and starting the program
failed, return code (intIdent_Int) will have an invalid value.
Note:
For OpenVMS only asynchronous - without parameters.
Example
The following example copies the file d:\d2000.v70\prefix\sqlback\syscfg.db
into the directory c:\archive using standard facilities of the
operating system (shell will run the command copy).
; Copying the file
; Source file
TEXT _copySrc = "d:\d2000.v70\prefix\sqlback\syscfg.db"
; Target directory
TEXT _copyDst = " c:\archive"
; Parameters for the command copy
TEXT _switch = "/Y "
; Return code
INT _ret
_ret := RUN "cmd /C copy " SYNC _switch + _copySrc + _copyDst
; or whole command declared as expression
; _ret := RUN "" SYNC "cmd /C copy + _switch + _copySrc + _copyDst
IF _ret # _ERR_NO_ERROR THEN
; error
ENDIF
END