The macro language provides read-only registers for the most important
system parameters, such as current module, current scenario or the current
date. However, when writing complex macros, it is often necessary to access
all kind of other data bank or system parameters. The special
p is available for accessing such parameters.
For this purpose, each available parameter is assigned an address,
which is to be used to access this parameter. When the
p register is set to such an address, the value of the corresponding
parameter is used when the
p register is used in substitutions or
conditionals. Thus, the
p register is different from the
other registers, since it behaves differently for read and write
accesses: parameter addresses are written to the
and parameter values are read from it.
The classes of parameters that are accessible via the
are: global data bank parameters, scenario numbers, scenario parameters,
and other system parameters. The following table lists the corresponding
|System Parameter Register P|
|1-80||Global parameters, as described in Appendix C.1 of EMME/2 User's Manual.|
|101-200||External scenario numbers (0: scenario slot empty, -1: scenario slot not available in data bank)|
|1001-1280||Scenario parameters 1-280 of the current scenario, as described in Appendix C.1 of EMME/2 User's Manual.|
|2000-2011||System parameters, as defined below|
|2001||Software (1: EMME/2, 2: STAN)|
|2003||Licence size (1-12)|
|2004||Type of operating system (1: UNIX, 2: DOS, 3: VMS)|
|2005||CPU time used since creation of the data bank (in 1/10 secs)|
|2006||Current year (0-99)|
|2007||Current month (1-12)|
|2008||Current day of month (1-31)|
|2009||Current hour (0-23)|
|2010||Current minute (0-59)|
|2011||Current second (0-59)|
~p=55 / global parameter MTURN, maximum size of turn table ~x=%p% / X=MTURN ~p=1004 / scenario parameter NTURN, current size of turn table ~x-%p% / X=X-NTURN ~/ Number of available turn table entries in scenario %s% is %x%.
Note that there is a potential synchronization problem when accessing the system parameters 2006 - 2011 for assembling a string with the current time. Imagine e.g. that this operation was started just a few milliseconds before midnight, so that instead of 92-05-16 23:59:59 one could obtain the string 92-05-16 00:00:00, which would clearly be wrong. To avoid such problems, the internal time values are replaced only if either more than 2 seconds passed since last time parameter access, or the last time parameter accessed was of higher or equal index. With these rules, no synchronization problems occur when accessing time parameters sequentially in the order given above.
cputimewhich calls the macro given as parameter and, after completion, reports the number of cpu seconds that were used during the execution of that macro.
filecopywhich copies the file given as the first parameter into the file given as second parameter. The macro should work equally well on DOS, UNIX and VAX/VMS systems.