The SEnC program is called as follows:
senc [options] [file|varspec ...]
where the specified input files contain the commands which are to be processed by the program. For the server commands discussed in the last section, this just implies sending the commands one by one to the Enif server and receiving the corresponding results.
The following command line options are recognized:
-d | Generate debugging output. Specifying this option several times will increase the amount of debugging output which is generated. |
---|---|
-e | Continue with input processing after errors. Unless this option is set, SEnC will stop processing the input as soon as it received a negative acknowledge (KO) from the Enif server. |
-h | Display this help summary. |
-i | Run SEnC in interactive mode. In interactive mode, the processed commands as well as the received replies are displayed in a separate window. In addition to executing commands read from the input file, in interactive mode it is also possible to enter server commands directly from the keyboard. |
-l | Launch the Enif program on the local machine upon starting SEnC and exit Enif when SEnC terminates. After having created the Enif process, SEnC waits for 3 seconds until it tries to contact the Enif server. when accessing a very large network and/or when using a slow or otherwise busy system, this delay may not always be sufficient. In this case, the -l option can be repeated more than once, each time adding another 3 seconds to the delay. Note that under Windows, SEnC tries to execute the program senc.exe, under Unix-like systems the program senc is used. In both cases, the corresponding program if first looked for in the standard locations pointed by the environment variables ENIFPATH or EMME2. Otherwise the called program must be located in a directory which is included in the user's PATH environment variable. |
-L progname | This option is similar to the -l option, but it contains an additional argument which allows the specification of the program name that is used to launch Enif. By default the program name enif is used. This option may be useful in situations (like testing of benchmarking) where several version of Enif coexist on the same system. |
-o outputfile | Direct the standard output to the specified file. |
-p port | This option defines the TCP/IP port used to communicate with the Enif server. |
-q | Quit after all input files are processed. This is the default unless running in interactive mode using the -i option. |
-s server | This option allows the specification of the host name or IP-address of of the system on which the Enif server is running. By default, the Enif server is assumed to run on localhost. |
-v | Generate verbose output. |
SEnC also contains a simple mechanism which allows to perform variable substitution on the processed input commands. This is done by specifying on the command line, before or between input files, arguments of the form variable=value (no spaces allowed!). If such an argument is processed, SEnC will create a corresponding variable, if it does not exist yet, and set its value to string left of the equal sign. Variables which are defined in this way can be used for substitution in commands which are subsequently processed. If such a command contains the string {variable}, it will be replaced by the current value of the parameter before the command is executed.
Let's now come back to our second telnet example of the previous section. Assume that, for whatever reason, we would need to automate the process of creating a list of links with auto volumes exceeding 3000. Having SEnC, we could simply store the server commands we previously typed into the telnet session into a file, say, named example1
new Expression linkval Links new Selector linksel Links linkval = volau,volad,timau,speedau linksel = volau>3000,-volau echo Scenario %<$ScenarioNumber>% (%<$ScenarioTitle>%): eval linkval linksel
and then run SEnC with the command
senc -l example1 >linklist.out
to obtain in the file linklist.out the lines:
Scenario 3000 (Kildonan Corridor): 609-608;3329.708;55;2.508259;8.133132 458-59;3209;0;1.2;10 705-713;3140.356;23.07692;0.617797;11.65431 611-610;3132.645;55;2.741341;10.06806 665-674;3105.219;0;0.811095;23.67171 668-665;3105.219;0;1.066585;12.37595 669-668;3105.219;0;1.308991;12.37595 516-608;3035.614;29.79895;0.454977;26.37496 517-516;3035.614;29.79895;0.432228;26.37496 607-606;3027.583;159.174;1.369371;10.07762 610-609;3016.525;55;1.423182;11.38294
If in addition, we want to be able to specify the scenario for which these links should be listed, we can change the input file to select the scenario by grouping with the system parameter $LoadScenario and use a variable which can then be set on the command line. The modified example input file example1a becomes then:
new Integer scenario scenario : $LoadScenario scenario[1] = {scen} new Expression linkval Links new Selector linksel Links linkval = volau,volad,timau,speedau linksel = volau>3000,-volau echo Scenario %<ScenarioNumber>% (%<ScenarioTitle>%): eval linkval linksel
We can produce the link list for a specific scenario, say scenario 1000, by calling SEnC as follows:
senc -l scen=1000 example1 >linklist1000.out
We conclude this example with a screen shot of the interactive mode display window that is displayed if the option -i is added to the above command. On screen, the displayed texts are color coded: the server commands sent from SEnC to the Enif server appear in blue, the output received from the Enif server in black, the client commands (which are discussed later on) in green, and interactively entered server commands are shown in red.
Note that the above example is also interesting since it does not use any of Enif's graphic capabilities at all, but it just uses Enif to access data from the EMME/2 data bank, using Enif's powerful expression and selector features. This opens the possibility for external programs which need to access some data from the EMME/2 data bank to incorporate an Enif clients and access the data bank via the Enif client/server interface. It avoids having to run EMME/2 macros to first punch out the desired data to sequential files from which it can then be read into the external program, or it provides a safe and protected alternative to the potentially dangerous method of having the external program read directly binary data from the EMME/2 data bank.
Combining Enif server command with SEnC's variable substitution mechanism already allows writing more flexible scripts, in which some of the information is not ``hard-coded'' but can be provided at run time, without any need to edit the command file.