The command line refers to using commands in the form of strings in DOS-like environment to execute programs. All operating systems support the command lines, like the Linux console and the Windows command line window.
The file, esprocx.exe, is needed when the command line is used to execute an esProc cellset file. The file can be found in esProc\bin path in esProc’s installation directory.
1. Cellset files without return results
Use the esprocx command to execute the cellset file at command line. Take the following cellset file, D:\files\output1.dfx, as an example:
Cellset files without return results are usually used to access files or databases. In the above cellset, for example, some simulation data are created and stored in a text file, Data1.txt. In using an esprocx command, enter the to-be-executed dfx file after it; during execution, prompts of start and end will be displayed on the screen, as shown below:
After the execution, the randomly generated data will be written into Data1.txt, as shown below:
If the path in which the esprocx file is located is included into the operating system’s path list, run the file directly instead of running it in esProc\bin path of the installation directory. But the to-be-called dfx file must be entered in its full path, or should be located in the current path. For example:
If the running cellset file uses parameters, enter their values, separated by spaces, after the dfx file when executing esprocx. Take the following cellset file D:\files\output2.dfx as an example:
The file uses two parameters: IDs and Value, as shown below:
The cellset is to import the Data1.txt file just created, modify some of the records with specified sequence numbers so as to make their Amount fields are equal to the specified Value and store them in the file again. The prompts displayed on the screen during execution are as follows:
Two parameters, one is a sequence, [2,3,5,7,11] and the other is an integer, 99999, are input while the cellset file, output2.dfx, is called. Similar to a cross-cellset call, the input parameters will assign value to the cellset parameters according to their orders instead of their names during the command line call. In this case [2,3,5,7,11] assigns value to the first parameter, IDs and 99999 assigns value to the second parameter, Value. After the command line is executed, data in Data1.txt will have been modified:
2. Cellset files with return results
If the esprocx command is used directly at the command line, the result won’t be displayed on the screen by default. If the return result of the dfx file is to be displayed, -R option needs to be used in execution. Similar to the cellset file called by the call function, the dfx file must return the result using return (or result) statement. Take the following cellset file, D:\files\calculate1.dfx, as an example:
|2||return A1||return B1|
This cellset will return the total number of days of the month in which the specified date occurs and compute what day the specified date is. It uses Day as one of its parameters:
Let’s first look at the execution with -R option:
Here no parameters have been set during the execution and a default parameter, 01/01/2000, is used for the computation. You can see that A2 and B2 respectively return a result using return statement. The results will be listed respectively after the computation is finished.
If a parameter is to be set, its data type should be date. As a parameter of date or time type should be in some kind of format, you need to set its format in the configuration file, config.xml, which is located in esProc\config path in esProc’s installation directory:
The execution is what the following shows if a parameter is set for the call:
At this point, you get the total number of days of the month in which February 22, 2012 occurs and what day this date is.
Different from the previous cellset file, the following one, D:\files\calculate2.dfx, returns the results as a sequence:
The execution is as follows:
It can be seen that members of the resulting sequence are listed respectively, each having a row.
Here comes the last sample of the cellset file – D:\files\calculate3.dfx:
|1||$(demo) select * from CITIES||$select * from STATES|
The cellset file uses a parameter – Letter:
This cellset uses the database data. In this case the database connection needs to be configured in config.xml in the esProc\config path in the esProc installation directory:
<property name=”url” value=”jdbc:hsqldb:hsql://127.0.0.1/demo”/>
<property name=”driver” value=”org.hsqldb.jdbcDriver”/>
<property name=”type” value=”HSQL”/>
<property name=”user” value=”sa”/>
<property name=”password” value=””/>
<property name=”batchSize” value=”1000″/>
<property name=”autoConnect” value=”true”/>
<property name=”useSchema” value=”false”/>
<property name=”addTilde” value=”false”/>
Please refer to related documents for detailed configuration method.
When the program is executed, the result is as follows:
To set a parameter of string type, it’s not necessary to surround it with double quotation marks. Cities whose names start with B are listed in the above result. For the result of the type of a table sequence or a record sequence, each record is a row and fields are separated from each other by tabs.
The above configuration file, config.xml, is also used by the Integration Development Environment (IDE), so information, like date format and datasource configuration, can be edited on the IDE interface. Click Tool>Option on the menu bar and configure the information on the Environment of Option window:
Click Tool>Datasource connection and configure information, like the database connection parameter, in the datasource manager. For detailed configuration method, please refer to esProc Accesses Databases: Database Configuration.