Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


EXECUTE

EXECUTE

The EXECUTE function compiles and executes one or more IDL statements contained in a string at run-time.

Note: Compiling the string at run-time is inefficient and can slow down your code. CALL_FUNCTION, CALL_METHOD, and CALL_PROCEDURE are efficient and provide much of the functionality of EXECUTE without imposing this limitation, and should be used instead of EXECUTE whenever possible.

Examples


Create a string that holds a valid IDL command and execute the command by entering:

math = 'cos(2*!pi)'
void = EXECUTE('result = ' + math)
PRINT, result

IDL prints:

1.00000

Set CompileFlags=2 to use Implied Print:

void = EXECUTE("4+4", 2)

IDL prints 8 to the output console.

Syntax


Result = EXECUTE(String [, CompileFlags] [, QuietExecution])

Return Value


EXECUTE returns true (1) if the string was successfully compiled and executed. If an error occurs during either phase, the result is false (0).

Arguments


String

A string containing the command(s) to be compiled and executed. Multiple statements in the string should be separated with the “&” character. GOTO statements and labels are not allowed.

Note: The command string has a limit of 32768 characters.

CompileFlags

Set this argument to one of the following values:

  • 1 - If this argument is set to 1 then EXECUTE will not print compiler-generated error messages (such as syntax errors) to the console or IDL Output Log. If CompileFlags is omitted or set to 0, EXECUTE will output such errors.
  • 2 - If this argument is set to 2 then EXECUTE will attempt to perform Implied Print on the input string. If the input string is not an expression or a variable name, then EXECUTE will compile and execute the statement as normal.

By default, if this argument is omitted, then EXECUTE will output any compiler error messages, and will not attempt to perform Implied Print.

QuietExecution

If this argument is set to a non-zero value, EXECUTE will not print error messages generated during execution to the console or IDL Output Log. If QuietExecution is omitted or set to 0, EXECUTE will output such errors.

Keywords


None.

Version History


Original

Introduced

5.2

Added QuietCompile argument

6.1

Added QuietExecution argument

8.3 Rename QuietCompile argument to CompileFlags (does not affect code) and allow CompileFlags=2 for Implied Print.

See Also


CALL_FUNCTION, CALL_METHOD, CALL_PROCEDURE, Implied Print



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us