Script EXEC Statement

EXEC <file name>

The EXEC statement is used to execute another script from within a script. The script file name is required.

Scripts may be nested eight levels deep. Variables defined in the calling script are available in the called script. When the called script completes, processing continues on the line immediately after the EXEC statement in the calling script. For example:

_filevar = <>
EXEC _filevar
ECHO "_filevar has completed processing."

executes the script Then it returns to the calling script and prints: has completed processing.

All scripts that are executed must reside in the User Scripts or Predefined Scripts folder as defined in General Preferences (located in the Setup menu on the Main Menu). The User Scripts folder is checked first for the script. If it is not found, the Predefined Scripts folder is checked. If the script is not found in either folder, an error message is displayed.

If an error occurs, the _$filerror system variable is non-zero.

Copyright © 2017 American Chemical Society. All Rights Reserved.