RUN
Top  Previous  Next

Use the RUN command to run command blocks, command files, and command files requiring passed parameters.

run

Options

cmdfile

Specifies the name of the command block or command file to execute.

On a workstation with multiple drives (local or mapped), especially when the files are on the different drive, it is always the best practice to define a drive letter when copying, deleting, renaming or running files, unless the specified files are located in the working directory. You will not need to specify the drive letter if all of the files are located in the default directory when using the copy, delete, rename or run commands.

IN procfile

Specifies the name of a procedure file. A procedure file is a compiled binary file that contains stored menu, screen, and command blocks. Include a drive and path name if the procedure file is not on the current drive and directory.

SELECT VARCHAR clause

Specifies a column defined with the VARCHAR data type from a table, then you can run the contents. The SELECT clause must limit the data to only one row; otherwise, an error is returned.

USING parmlist

Lists the values the command file uses when it runs. The parameter list can contain up to 18 values. The first value in the list is referenced in the executed file as %1, the second as %2, and so on through %9. They are treated just like other variables. To reference the contents of these variables, preface the variable name with a dot (.); for example, set v1 =.%1.

About the RUN Command

The RUN command must be on a line by itself and not combined with other commands.

Examples

The following command runs a file named MYCMDFIL in the current working directory.

RUN mycmdfil

The following command runs a command block named mycmdfilin the MYPROCFL procedure file.

RUN mycmdfil IN myprocfl

The following command executes the mycmdfil command block in the MYPROCFL procedure file, placing the parameter values, Display This Message and 10, into parameter variables %1 and %2, respectively.

RUN mycmdfil IN myprocfl USING 'Display This Message' 10

The following commands, which use the system variable #time, make up a timing procedure called mycmdfil.This procedure displays the message passed as parameter %1for the length of time indicated in parameter %2. If mycmdfil is added in a procedure file named MYPROCFL, the RUN command causes mycmdfil to display the message for 10 seconds.

$COMMAND
mycmdfil
SET VARIABLE vstart TIME = .#TIME, vwait INTEGER = 0
WHILE vwait < .%2 THEN
   SHOW VARIABLE %1 AT 10 20
   SET VARIABLE vwait = (.#TIME - .vstart)
ENDWHILE
CLS FROM 10 TO 10
CLEAR VARIABLES vstart, vwait, %1, %2
RETURN

The following RUN command causes mycmdfil to run for five seconds.

RUN mycmdfil IN myprocfl USING 'Shorter Message' 5