It is often desirable to pass information to an IMLPlus program from the command line used to run it. You may want to specify the name of a data set or the names of variables. IMLPlus.exe enables you to pass up to 32 named parameters to an IMLPlus program.
Each command-line parameter has a name and a value. The syntax for defining a command-line parameter is:
-d name=value
or
-d name="value"
A command-line parameter's name must conform to the following rules:
Command-line parameter names are not case sensitive.
A command-line parameter's value must conform to the following rules:
An IMLPlus program can retrieve the value of a command-line parameter by using the method Runtime.GetCommandLineParameter.
Suppose the file Example.sx contains the following IMLPlus program:
declare DataObject dobj; dataset = Runtime.GetCommandLineParameter( "DataSet" ); dobj = DataObject.CreateFromFile( dataset ); xvar = Runtime.GetCommandLineParameter( "X" ); yvar = Runtime.GetCommandLineParameter( "Y" ); declare ScatterPlot plot; plot = ScatterPlot.Create( dobj, xvar, yvar ); PlotFileName = Runtime.GetCommandLineParameter( "PlotFileName" ); plot.SaveToFile( PlotFileName, 800, 533 );
The following invocation of IMLPlus.exe will run the program:
imlplus Example.sx -d dataset=baseball -d x=no_hits -d y=no_runs -d plotfilename=Example.bmp
If everything runs correctly, this program will create a bitmap graphics file called Example.bmp that contains a scatter plot of the variables NO_HITS and NO_RUNS from the data set baseball.sas7bdat.