EXECUTE Function

Runs the specified program.

Category: External File
Returned data type: Integer
Note: The returned value represents the existing status of the program. If an error occurs, such as the program not found, then -1 is returned.

Syntax

EXECUTE(<filename<option1, option2,..., <option N>>

Required Argument

filename

a string representing the file (or command) to be executed; this can be specified as a fixed string, field name, or expression.

Optional Argument

option1...N

[optional] a string representing options that are passed to the file (command) that is going to be executed; this can be specified as a fixed string, field name, or expression.

Details

The execute function invokes a file (or operating system command).
Note: Use single quotation marks for any parameter with embedded spaces. For example:
execute('cmd.exe','/C',
     '"C:\Program Files (x86)\DataFlux\DMStudio\studio24\bin\dmpexec.cmd"',
     '-j', '"C:\Repository24\batch_jobs\my data job.ddf"',
     '-l', '"C:\temp\log my data job.log"')

Example

integer rc
 
// Windows example
rc = execute("cmd.exe", "/Q", "/C", "C:\mybatchjob.bat")
// /Q turns echo off
// /C executes the command specified by filename and then closes the prompt
 
// Unix example
rc = execute("/bin/sh", "-c", "chmod 777 file.txt")