Runtime.RunProgramFile

Prototypes

static void RunProgramFile( String sPathName <, String sServerName <, boolean bActivateWorkspace <, boolean bViewProgramWindow <, int nCloseLevel >>>> )

Parameters

String sPathName
The path and filename of the program file you want to run.

String sServerName
The name of the server on which you want to run the program. This name must either be "My SAS Server" (which refers to the installation of SAS on your computer) or the name of a logical SAS Workspace Server defined in the SAS Metadata Server. If sServerName is an empty string ("") or null, IML Studio runs the program on the default SAS server configured in the Options dialog box. Calling this method without specifying the sServerName parameter is equivalent to calling it with sServerName equal to null.

boolean bActivateWorkspace
If bActivateWorkspace is true, IML Studio activates the workspace for the program. If bActivateWorkspace is false, IML Studio does not activate the workspace for the program. Calling this method without specifying the bActivateWorkspace parameter is equivalent to calling it with bActivateWorkspace equal to true.

boolean bViewProgramWindow
If bViewProgramWindow is true, IML Studio shows the program window for the program's workspace. If bViewProgramWindow is false, IML Studio does not show the program window for the program's workspace. Calling this method without specifying the bViewProgramWindow parameter is equivalent to calling it with bViewProgramWindow equal to true.

int nCloseLevel
An integer that determines whether the program's workspace closes automatically when the program stops running. The possible values are as follows:

0
Do not close the workspace.
1
Close the workspace if the contents of the program window have not changed and the error log is empty.
2
Close the workspace if the contents of the program window have not changed and the error log does not contain any IMLPlus warnings or errors.
3
Close the workspace if the contents of the program window have not changed and the error log does not contain any IMLPlus errors.
4
Close the workspace if the contents of the program window have not changed.
5
Always close the workspace.
Remarks

This method runs another IMLPlus program. If the program file is not already open in IML Studio, IML Studio creates a new workspace for the program. If the program file is already open in IML Studio, IML Studio does not reload the file from disk; it runs the program as it appears in the existing program window.

Notes
Example
run GetPersonalFilesDirectory( PathName );
PathName = PathName + "Programs\DynamicallyGeneratedProgram.sx";

arg1 = "The answer is";
arg2 = 42;

ProgramText = { "print '&arg1';",
                "print (&arg2);" };
ProgramText = tranwrd( ProgramText, "&arg1", arg1 );
ProgramText = tranwrd( ProgramText, "&arg2", strip(char(arg2)) );

print ProgramText;

Runtime.WriteProgramFile( PathName, ProgramText );
Runtime.RunProgramFile( PathName );
See Also

Runtime.WriteProgramFile