You are on page 1of 41

5

5 Macros

Macros are used to provide “automatic” answers to the Emme dialog. A macro may contain a
sequence of dialog responses which is used frequently, thereby eliminating the need to enter the
individual answers every time. Macros are also very useful for implementing lengthy procedures,
especially those that are used with different sets of parameters or input data.

An Emme macro depends on information contained in sequential text files which, unlike the
Emme data files, are never read into the database. It is therefore easy to create or modify macros
and annotations using a text editor and to exchange them for use with different databases.

This chapter contains the following:

• Section 5.1 describes the capabilities of the Emme macro language, which is used to define mac-
ros, and the interactive commands available for debugging macros in single step tracing mode.

• The Emme package contains some macros that are supported by INRO. Section 5.2 describes
these macros (modifydb, split2layovers, emme2notify, emme2shp).

2007/02/23 5-1
Macro Language Emme Prompt Manual

5.1 Macro Language

A macro is a file which contains a sequence of answers to the questions posed in a given dialog.
The maximum macro line length is 128 characters. In its simplest form, a macro consists of a
sequence of predefined answers. Simple macro creation and recall, using only the macro save
(~>) and macro recall (~<) commands, is described on page 3-20. However, for users that need
to implement complex repetitive procedures, a powerful set of macro commands (see Table 5.1)
is available. By using features of the macro language such as the substitution mechanism, condi-
tional and branching commands, register arithmetic and feedback of macro result values via sca-
lars, it is possible to write more complex macros that generate answers which may vary from one
run to another (or from one database to another).

Macro run-time parameters

The actual dialog responses generated by a macro can be varied from one macro call to another
by using macro arguments specified in the macro call command or by using information entered
during macro execution in response to a terminal read command.

• Macros may be recalled with optional arguments. The arguments are used to substitute for the
positional parameters %1%, %2%, …, %32% that appear in the macro. The formal parameter %0% is
substituted by the current number of arguments (see Substitutions in macros on page 5-4). The
substitution mechanism may also be used while a macro is being created, that is, lines containing
formal parameters are first saved in the macro file and then the substitution using any arguments
from the macro save command is carried out, before the input line is used as a dialog response
or macro command. For example, a macro named vdpar which specifies the volume-delay func-
tion to be plotted together with the values for the different variables, may be created in the follow-
ing way :

Enter: Next module=device

Enter: Function=~>vdpar fd1 0 1 1


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

%1%
fd1 = length * (2.4855 + (.005887 * (volau + volad) / lanes) ^ 3.6596)
Creation of a macro with Enter: Variable to plot on horizontal axis=volau
Enter: Range of volau ( 0.00, 100.00)=
initial parameters
Set of curves for a variable?n
Enter: volad=%2%
Enter: lanes=%3%
Enter: length=%4%

Other functions on the same plot?~>

The values fd1, 0, 1 and 1 are the initial values for the macro parameters %1%, %2%, %3% and
%4%, to be used while the macro save command is active. The saved macro can then be recalled
for any function with the same keywords, by calling the macro with the new values. For example,
entering ~<vdpar fd2 1 2 1 will generate dialog answers using these new values :

Enter: Next module=device

Enter: Function=~<vdpar fd2 1 2 1


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

< fd2
fd2 = length * (1.621 + (.002662 * (volau + volad) / lanes) ^ 3.5038)
Recall of a macro with new Enter: Variable to plot on horizontal axis= < volau
Enter: Range of volau ( 0.00, 100.00)= <
parameters
Set of curves for a variable? < n
Enter: volad= < 1
Enter: lanes= < 2
Enter: length= < 1

Other functions on the same plot? <~<

5-2 2007/02/23
Emme Prompt Manual Macro Language

Table 5.1 Macro commands


Macro command Action

~# comment Macro comment line (not copied to the terminal). See page 5-4.
~/ comment Comment line to be copied to the terminal, with (~/) or without (~~/) line
~~/ comment feed. See page 5-4.
~% Shift parameters down (%1% ← %2%, %2% ← %3% …).1 See page 5-2.
~+X…X…X… Compound command. Used to define one line of a macro file which is
composed of multiple dialog input lines. See page 5-8.
~! external cmd Command escape. Execute operating system command external cmd.

Operations on registers ~ reg ⊗ value Perform arithmetic operation on writable numeric register reg . The opera-
tor ⊗ can be :
= initialize reg to value (reg= value )
+ add value to reg (reg=reg + value )
− subtract value from reg (reg=reg - value )
∗ multiply reg by value (reg=reg * value )
/ divide reg by value (reg=reg / value )
% set reg to reg modulo value (reg=reg .mod. value )
& bitwise AND value to reg (reg=int(reg ) & int(value ))
| bitwise OR value to reg (reg=int(reg ) | int(value ))
See Read/write registers on page 5-13.

Test commands ~?reg ⊗ value Conditional command.1 Execute next line only if expression is true (~?) or
~?!reg ⊗ value false (~?!). The comparison operator ⊗ can be :
= equal
< less than
> greater than
& bitwise AND (for integer registers only)
Register reg must be one of the registers listed in Table 5.3.
See Tests in macros on page 5-7.
~?e Test for error condition.1 Execute next line only if an error condition has
~?!e (~?e) or has not (~?!e) occurred. See page 5-7.

Branching commands ~: label Define an address label (target for a branch command). See page 5-7.
~$ label Branch to the specified address label.1 Search starts at the beginning of
~$> label the macro file (~$), or from the current position (~$>). See page 5-7.

Input/output commands ~*prompt string Read one line from terminal, with optional prompt string. See page 5-4.
~< macro p1…pN Call macro as a sub-procedure of the current macro. See page 5-9.
~<<filename Open the macro filename. See page 5-10.
~@ Read one line from the macro filename opened using ~<<. See page 5-10.
~>>filename Append subsequent dialog answers and macro commands to file file-
name. See page 5-10.
~"text Append text to file filename opened using ~> or ~>>. See page 5-10.

1. Only in a recalled macro.

2007/02/23 5-3
Macro Language Emme Prompt Manual

• The shift command (%) shifts down by one index all current arguments, providing a convenient
way to process arguments one by one. The first parameter is discarded, the second parameter
takes the place of the first, etc. This allows access to all parameters, using the positional
parameters %1%, %2%, …, %32%, even when a macro has been called with more than
32 arguments.

• A terminal read command (~*) provides an alternate way of defining parts of a macro at run
time. When it appears in a macro, the user is prompted to input one line from the terminal. This
line is processed instead of the terminal read command and macro processing continues normally
thereafter. If any text string follows the asterisk, it will be used as a prompt string; otherwise >>
will be used.

Example of a terminal read


command ~*Enter: File to be used=

Comments in macros

The macro file can include comments. The ~# command is used to annotate or document the
macro program itself, whereas the ~/ or ~~/ commands are used to display comments on the ter-
minal while the macro is running. When the ~~/ variant is used, the comment line is not termi-
nated by a line feed, so that subsequent macro output is displayed on the same line (bit 1 of the o
register must be set; see Table 5.4). Note that trailing blanks are ignored.

Substitutions in macros

The macro language provides a general substitution mechanism that may be used to generate
answers which are not fixed. These answers are coded in the macro as substitution keys, which
are always surrounded by the % sign.

• Before being executed, each line of the macro is pre-processed, that is, any substitution key is
replaced by the appropriate value. The substitution keys, which are recognized and replaced
when they appear in a macro, are listed in Table 5.2.

• The string %%% can be used to force a % in the dialog input. For example, in order for a macro to
issue menu commands such as batchout=b%s%.%m% (see File naming of input and output on
page 3-30, and Module 0.00), it is necessary to prevent immediate substitution of %s% or %m% by
the current scenario and module number. In this case, the macro line would be :

batchout=b%%%s%%%.%%%m%%%

Within a compound macro line (see page 5-8), substitutions occur when the macro line is read
and again for each separate dialog input line generated. Therefore, for a parameter to be substi-
tuted at the dialog input line level, it must be specified with %%%, for example : %%%x%%%.

• Scalar substitution (%ms X%) provides access to the value of a scalar matrix specified by the
number X, if X is a number from 1 to 999, or of a scalar matrix whose number is specified by con-
tents of register X, if X is the letter x, y or z.

5-4 2007/02/23
Emme Prompt Manual Macro Language

Table 5.2 Macro substitution keys

Key Replaced by

%0% Current number of macro parameters (0 to 32) that can be accessed by


the positional parameters %1% … %32%. This number is affected by the
shift command (%). See page 5-4.

%1% … %32% Positional parameters 1 … 32 (string, empty if argument not specified).


Text register t0 contains the current macro parameters.

%%% Character %. Used to prevent the substitution of a valid substitution key.

%reg% Value of register reg. Value is a number for numeric registers or a text
string of up to 128 characters for text registers. See Table 5.3.

%gX% %rX% Value of floating point registers rX or gX, where X is a number from 1 to
250 or the letter x, y or z.

%msX% Contents of scalar matrix X, where X is a number from 1 to 999 or the let-
ter x, y or z (matrix number is contents of register x, y or z).

%mTX.d% Description of matrix mTX, where T is the letter f, d, o or s and X is a num-


ber from 1 to 999 or the letter x, y or z (matrix number is contents of regis-
ter x, y or z).

%mTX.n% Name of matrix mTX.

%mTX.t% Time stamp of matrix mTX.

%tX.L% or %tX_L% The first L characters of text register tX, where X is a number from 0 to 9
or the letter c, e, l, p, s or u. See page 5-12.

%tX.-L% or The contents of text register tX excluding the first L characters.


%tX_-L%

%textsub_W% Any text substitution left justified in W characters.

%numsub_W% Any numeric substitution right justified in W characters.

%numsub.D% Any numeric substitution with D decimals.

%numsub.D_W% or Any numeric substitution with D decimals and right justified in W charac-
%numsub_W.D% ters.

%reg_>W% Contents of any register reg right justified in W characters.

%reg_<W% Contents of any register reg left justified in W characters.

• It is also possible to access the matrix name (%m TX.n%), description (%m TX.d%) and time
stamp (%m TX.t%) for any matrix m T, where T is the matrix type (f, d, o or s). By default, trailing
blanks are removed from the name and description. The time stamp can be used to test the exist-
ence of a matrix using such a substitution. In the following example, the time stamp of matrix mf9

2007/02/23 5-5
Macro Language Emme Prompt Manual

is read into register t1. The first character of register t1 is tested: if it is % (no substitution possi-
ble) the matrix does not exist; otherwise, a substitution occurred indicating that the matrix exists.

Macro to test for existence of ~t1=%mf9.t%


mf9 using time stamp ~/%t1%
substitution ~t1=%t1.1%
~/%t1%
~+;~?t1=%;~/Matrix mf9 does not exist.
~+;~?!t1=%;~/Matrix mf9 exists!

Output from above macro if


mf9 exists <~/98-03-24 14:35:19
<~/9
<~/Matrix mf9 exists!

• Text substitution (%tx.L% or %tx_L%) provides access to substrings in text registers (see Text
registers on page 5-13). L is an integer number that defines the substring to be retained. When
L is positive (L > 0), the first L characters of the text register are retained. When L is negative
(L ≤ 0) the first L characters are skipped and only the characters that follow are retained. For
example, %t7_1% yields the first character of text register 7, and %t6.-10% yields the substring
from text register 6 starting at character 11 (first 10 characters are skipped, trailing blanks
removed).

• When using %msX%, %rX% and %gX% numeric substitutions, it is possible to specify the number
of decimals. The number of decimals is specified using a dot (.) followed by a digit D (D=0 … 9).
If D=9, the default automatic format conversion is used. If D=0, the nearest integer is substituted.
For example, if the value of g1 is 123.789, %g1.0% will be replaced by 124.

• When using numerical register or scalar (%msX%) substitutions, it is possible to specify the field
width. This can be done by using the underscore character ( _ ) followed by a number (maximum
99). The field width feature also applies to the scalar name (%msX.n%) and description
(%msX.d%) substitutions. Unless adjustment is explicitly specified, numeric registers are
right-adjusted whereas text registers are left adjusted in the specified field width. For example :
%x_10% will be replaced by the value of register x, right-adjusted in a fixed field of 10 characters;
%ms15.n_6% will be replaced by the name of scalar ms15, left adjusted in a fixed field width of
6 characters (instead of dropping the trailing blanks from the name).

• The specifications of the number of digits (using .D ) and of the field width (using _W ) are
independent. For example, both %ry_12.4% and %ry.4_12% will be replaced by the contents of
the floating point register whose number is specified by contents of register y, using a fixed field
width of 12 characters and a precision of 4 digits after the decimal point.

• Adjustment of numeric and text substitutions:


The adjustment of numeric and text substitutions can be specified explicitly using the < and >
characters, immediately following the underscore character ( _ ), to indicate left (<) or right (>)
justification. This adjustment is available wherever the substring ( _L ) or field width ( _W ) clause
appears. Note that when adjusting substitutions from a text register using %tX_<-L% or
%tX_>-L%, the field width is the length of the text substring minus L.

Text substrings are left or right-adjusted from the first non-blank character and padded, if neces-
sary, to the right for left justification or left for right justification. For example, in the following
macro, the matrix description for matrix mf1 is output using different types of text substitutions and
adjustments. Single quotes have been added to show the adjustment of the text within the speci-
fied field widths. The matrix description for mf1 is stored in text register t1. The contents of t1
are then displayed: in full ('%t1%'); in part using the left adjusted substitution %t1_<-4% (note

5-6 2007/02/23
Emme Prompt Manual Macro Language

the padding space to the right); in part using the right-adjusted substitution %t1_>5% (note the
padding space to the left).

Macro to show left and right ~t1=%mf1.d%


adjustment of text ~/'%t1%'
~/'%t1_<-4%'
substitutions
~/'%mf1.d_>5%'

Output from above macro. <~/'AM auto demand from survey (vehicles)'
<~/'observed auto demand (vehicles) '
<~/' 1976'

Following are other examples of output formatting :

%x_<15% Left justify contents of register x using a field width of 15


%r1_>8% Right justify contents of register r1 using a field width of 8 (same as %r1_8%)
%r3_<10.2% Left justify contents of register r3 using a field width of 10 and a precision of 2
digits after the decimal point (same as %r3.2_<10%)
%t1_<6% Left justify contents of register t1 using a field width of 6 (leading blanks are
removed; same as %t1_6%)

Tests in macros

• There are two conditional commands : ~? condition and ~?! condition. ~? is used to execute the
next line only if condition is true, skipping it otherwise. ~?! is used to execute the next line only
when condition is false (! is the logical negation operator). The condition has the format
reg ⊗ value where ⊗ may be a comparison (>, =, <) or, for integer registers only, a bitwise AND
(&) operator (true if non-zero). For example, the command ~?x>3 appearing in a macro will
cause the next line to be executed only if register x contains a value that is greater than 3.

A condition of the form ~?e will cause the next line to be executed only if an error was detected
while processing the previous input line. This allows an error, which would normally cause the
macro processing to stop immediately, to be trapped and corrected.

• A macro may contain label (~:label ) and branch commands (~$ label and ~$> label ). Note that
label consists of all remaining characters on the line. When a macro branch statement is exe-
cuted, the search for the label is sequential and starts at the beginning of the macro file for the
~$ label command (allowing forward and backward branching), or immediately after the forward
branch command ~$> label (allowing only forward references). If it can be used, a forward branch
(~$>) is more efficient. Label and branch commands are especially useful in combination with the
conditional commands discussed above. For example, the following will cause the macro to
branch to label loop if register x is equal to zero, or to continue otherwise.

Example of test and


branching in a macro ~?x=0
~$loop

2007/02/23 5-7
Macro Language Emme Prompt Manual

Compound macro statements

A compound macro command (~+) can be used to concatenate several macro lines into one line
in a macro file. The macro lines are separated by a character (X ) which immediately follows the
compound command. Thus a compound macro line has the following format :

~+X line1 X line2 X…X lineN

where X can be any character and line1 , line2 ,… lineN are each a macro line. The character
used as separator must be chosen such that it does not appear in the macro lines. A label com-
mand (~:) cannot be used in a compound macro line.

Some advantages of using compound macro commands to form macro lines each containing sev-
eral input lines are :

• Dialog input lines that logically belong together can be grouped and long macros become shorter
and more efficient. The following examples show the initialization of a matrix, first with one dialog
response per line, and then using a compound macro statement with the # character as
separator.

Example dialog to initialize mf9


a matrix without compound y
autsb
commands
auto times of scenario 1000
~?q=1
y
0

Same dialog using


compound command ~+#mf9#y#autsb#auto times of scenario 1000#~?q=1#y#0
(separator is #)

• One conditional command can be applied to several dialog input lines and/or macro commands.
A conditional command (~?), which occurs immediately before a compound command, is applied
to the entire compound macro line. If a conditional command appears within a compound macro
line, it is applied to the next part of the compound macro line, that is, to the dialog input line or
macro command which immediately follows the conditional command. If the conditional com-
mand was the last part of a compound macro line, the conditional command is applied to the fol-
lowing line in the macro file.

• Loops that can be coded on a single line are executed more efficiently.
An empty branch statement (~$ without a label) is interpreted as a branch back to the start of the
compound macro line. This allows implementation of very efficient small loops since no backward
branching is required. Regular branch commands (~$) to a specified label can also appear in a
compound macro line. The following macro, which copies g-registers into r-registers, uses an
empty branch statement to loop back to the beginning of the line until all 250 registers have been
copied.

Loop to copy all g-registers ~x=0


into r-registers ~+;~x+1;~rx=%%%gx%%%;~?x<250;~$

• Multilevel (or nested) substitutions can be executed on a single line.


Since within a compound command line substitution occurs once after it is read and again when it
is executed, nested substitutions are possible. For example, when the string %%1%.n% in the

5-8 2007/02/23
Emme Prompt Manual Macro Language

compound line in the macro below is read, %1% is substituted by the specified macro parameter (in
this example, a matrix) resulting in the string %mTX.n%. This string is subject to substitution again
when the ~/ command is executed. If the string fs%%1%.n% was included in a regular command
line (without compound command) only the substitution of %1% would be performed.

The macro below shows two series of text substitutions: one with, and one without a compound
command line. The name and description of a matrix that is specified as a macro parameter are
stored in text registers t1 and t2 by the first series which uses compound command lines, but in
the second series only the macro parameter substitution takes place.

Multilevel substitution:
• with → ~+;~t1=%%1%.n%
~+;~t2=%%1%.d%
~/%t1% %t2%
• without
a compound command.
→ ~t1=%%1%.n%
~t2=%%1%.d%
~/%t1% %t2%

The output below, shows how the nested substitutions are interpreted. The nested substitutions
with compound command lines will print the name and description for matrix mo3, while the sec-
ond series of substitutions (using a regular command line) prints out text strings with mo3 substi-
tuted for %1%.

Output from above macro. <~/auown0 autos per 1000 inhabitants


<~/%mo3.n% %mo3.d%

Nested macros

Macros can be called from within a macro.

Call 3 macros within the


main macro ~< macro1
~< macro2
~< macro3

• Each called macro gets its private set of register values (see Macro registers ) with initial values
inherited from the calling macro. This implies that parameters and state information may be
passed to the called macro through these registers and the global registers (see below). It also
implies that the called macro should explicitly initialize the registers it uses.

• Except for numeric registers gX and text register t9, read/write registers (see page 5-13) are local
variables. Therefore, a called macro can modify these registers with no consequence for the call-
ing macro. Upon return, the calling macro continues with its own set of register values.

• Numeric registers gX and text register t9 are global registers, that is, their values are common to
all levels of macros. These global registers can be used to pass return values to a calling macro.
(Note that the numeric registers gX are initialized to zero whenever a new module is entered.)

• Each macro level can have its own separate file open for reading (see open read file command on
page 5-10). Like numeric and text registers, if a macro calls another macro, the open read file is
inherited by the lower level macro. This means that the lower level macro can actually use ~@
commands and continue to read the file from the position the file was in (in the upper macro) when
the lower macro was called. However, this will not change the file position in the upper level

2007/02/23 5-9
Macro Language Emme Prompt Manual

macro upon return from the lower level. Hence, the state of an open read file is always preserved
when calling lower level macros, regardless of whether these macros open other read files them-
selves, or perform read operations on the open file they inherited.

• Similarly, each macro level can also have its own separate file open for writing (see append to file
command on page 5-10). If a macro calls another macro, the open output file is inherited by the
lower level macro. The lower level macro will continue to write to the open output file from the
position the file was in (in the upper macro) when the lower macro was called. However, this will
not change the file position in the upper level macro upon return from the lower level. Hence the
state of an open output file is always preserved when calling lower level macros, regardless of
whether these macros open other output files themselves, or perform append operations on the
open output file they inherited.

• There is no limit on the number of levels of macro calls. Recursive calls to macros are allowed.

Reading/writing to external files

• The open read file command (~<<filename ) specifies the name of a file that is to be read using
the file read command ~@ (see below). The file will remain open until one of the following condi-
tions is met:

• an empty open read file command, ~<<, is executed

• a new file is opened with an open read file command

• a file read command ~@ fails because the end of file has been reached or because of an I/O
error

• the macro that opened the file is terminated.

• The file read command (~@) reads the next input line from the file previously opened with the
open read file command (~<<). The ~@ command is similar to the terminal read command (~*), in
that it can be used alone when the line is to be interpreted as a dialog answer or macro command
line, or in combination with the set text register commands (see Text registers on page 5-13).

If there are no more input records available, or if an I/O error occurs when attempting to read a
record, an error flag is set. This causes the macro to terminate unless the error register is tested
immediately after an invalid file read command (with ~?e, for example – see Tests in macros on
page 5-7).

• The append to file command (~>>filename ) opens the file filename and appends subsequent
dialog answers and macro command lines to the contents of filename until the next ~> or ~>>
command. If filename does not exist, the ~>> command behaves exactly as the macro save (~>)
command.

This command can be used, in combination with the quoted output command (see below), to gen-
erate any text file, including other macros or trace files for off-line debugging.

• The quoted output command (~") can be used to generate any text file from within a macro. It
has no effect on the macro that is currently running. However, when this command is executed
while a macro save (~>filename ) or a macro append (~>>filename ) command is active, only the
characters following the leading ~" of this command, if any, are transcribed into the output file
record. Note that trailing blanks are ignored.

5-10 2007/02/23
Emme Prompt Manual Macro registers

5.1.1 Macro registers

There are three types of macro registers : read-only numeric registers, read/write numeric (integer
and floating point) and text registers, and the special register p. Text registers have a maximum
length of 128 characters.* The registers are listed in Table 5.3.

Read-only registers

• Register b contains a batch mode indicator : 1 for interactive, 2 for batch.

• Register d contains an integer value of the form yymmdd (switch 25 off) or yyyymmdd (switch 25
on), where yy[yy] indicates the year (2 or 4 digits), mm indicates the month (01-12) and dd indi-
cates the day of the month (01-31).

• Register e contains the number of the last error (warning or fatal) which occurred, as described in
Appendix A. It is particularly useful for checking if errors occurred while reading a batch input file,
since such errors will not stop the macro.

• Register f contains an integer which represents the bit pattern corresponding to the current state
of the flags of the current scenario (for description of the bit pattern, see scenario parameter
istats on page C-11). For example, to test if the current scenario contains a valid auto assign-
ment (bit 10 on) and is ready for a transit assignment (bit 6 on), the value of register f should be
compared (bitwise AND) to 1088 (2^6 + 2^10).

Table 5.3 Macro registers

Register Type Contents

b read-only Batch mode indicator (1 : interactive, 2: batch).

d read-only Date (integer, yymmdd or yyyymmdd, depending on state of


switch 25).

e read-only Number of the last error which occurred.

f read-only Current state of the flags of the current scenario (bit map).

g0 read-only Value of the bucket rounding residue when using the bint() intrinsic
function (see Section 3.7.2, page 3-57)

g1 … g250 read/write Global floating point registers that can be used to access the
get()/put() stack values or the third dimension balancing
coefficients.
Initialized to zero whenever a new module is entered.

i read-only Current state of all switches (bit map).

m read-only Current module number (integer, xyy, omitting decimal point).

o read/write Output register (bit pattern). Action described in Table 5.4.

p write addr. Address of the global or scenario parameter to be accessed (see


read value Table 5.5).

* Since the macro line length is also limited to 128, it is normally not possible to attain this maximum.

2007/02/23 5-11
Macro Language Emme Prompt Manual

Table 5.3 Macro registers (continued)

Register Type Contents

q read-only Type of current dialog question (0 : Enter, 1 : yes /no, >1 : Select ,
−1 : bit 6 on).

r1 … r250 read/write Numeric floating point registers

s read-only Current scenario number.

ta read-only Text registers (a = c, e, l, p, s or u).

tn read/write Text registers (n = 0 … 9).

v read-only Version number of current module.

x, y, z read/write Numeric integer registers.

• Register i contains an integer which represents the bit pattern corresponding to the current state
of all switches (for description of the bit pattern, see global parameter ishort on page C-8).

• Register m contains the current module number as a 3 digit integer. It can be used to test if a
macro is called within the right module and, for example, stop with a message if not. For example,
~?m=000 tests if the current module is 0.00 (main menu).

• Register q contains the type of the current dialog question :


q = 0 Enter question
q = 1 yes/no question
q > 1 Select question (q = number of alternatives).
q = −1 extra input line caused by bit 6 of register o (see Table 5.4).

Register q can be tested to determine the type of question being asked, in order to synchronize
the macro when the dialog may vary, depending on the context (for example, when preparing an
auto assignment on a scenario that may have already been assigned).

Example of a macro testing ~+;5.11;1 / Prepare fixed demand auto assignment


the type of question ~?q=2 / is scenario already assigned?
2 / new assignment
...

• Register s contains an integer equal to the current scenario identifier.

• Text registers ta contain the following strings :


tc unit of cost text
te unit of energy text
tl unit of length text
tp project title
ts current scenario title
tu user’s initials (%tu% same as %u%)

• Register v contains the version of the current module. This allows macros to be programmed to
run on different releases/versions of Emme. The version number is stored as R x 100 + L, where
R is the Release number and L is the Level. For example, knowing that the possibility to store the

5-12 2007/02/23
Emme Prompt Manual Macro registers

first waiting times in the transit assignment was introduced in version 4.3 (%v% = 403) of
Module 5.11, one could add the following test after the specification of the total waiting time
matrix :

Answer in macro depending ~?v>402


on contents of register ‘v’ n / no first waiting time matrix

Read/write registers

The values of read/write registers can be manipulated using ~ reg ⊗ value commands (see
Table 5.1). The current values of these registers are kept from one module to another, except for
the numeric registers gX which are initialized to zero whenever a new module is entered.

• Text registers

Text registers, t1 to t9, can hold up to 124 (128 - length of the assignment command ~t n =) char-
acters of text each. They are set using the ~t n = text command and inserted into a line using the
substitution %t n %. In addition, writable text registers can be compared (lexical collating
sequence) using the conditional commands ~?t n = text, ~?t n >text and ~?t n < text, as well as the
converse form : ~?!. It is also possible to use ~t n =~*, which prompts the user for text that is
stored in the text register for later use, or ~t n =~@, which stores the result of the file read com-
mand (see page 5-10) in the text register, but the text is not passed to Emme as dialog input in
either case.

Result of a file read ~<<infile


command stored in t5 ~t1=~@
~/line read from infile is %t1%

Text register t0 can also be accessed using the same commands, but it contains the current
macro arguments. Register t0 can be modified, either by using the shift command (see
page 5-4), or by using the assignment command (~?t0= text ), effectively replacing the current
macro arguments. This allows a text item to be separated into its individual fields since the fields
in t0 can be referenced using %1% %2% … %32%. Note that, although not accessible to the user,
the name of the macro is also stored in t0. Therefore, the effective number of characters that t0
can hold is 128 - length of macro name (including the path).

• Numeric registers

Five integer registers, named o, p, x, y or z, and two sets of floating point registers, named r1
to r250, and g1 to g250, can be used to do arithmetic operations. The operations available for
these numeric registers are :

• Initialization to given value.


Example : ~r1=1.5 will set register r1 to 1.5.

• Addition of the specified value.


Example : ~y+1 will increment register y by 1.

• Subtraction of the specified value.


Example : ~z−%x% will subtract the current value of register x from register z.

• Multiplication by the specified value.


Example : ~r2∗5 will multiply the current value of register r2 by 5.

2007/02/23 5-13
Macro Language Emme Prompt Manual

• Division by the specified value. If the specified value is equal to 0, the operation is ignored
and the value of the register is not changed.
Example : ~r2/5 will divide the current value of register r2 by 5.

• Modulo operation (remainder from division). If the specified value is equal to 0, the operation
is ignored and the value of the register is not changed.
Example : ~x%5 will set register x to the current value of x, modulo 5.

• Bitwise AND (reg=int(reg ) & int(value ))


This operation is useful for querying the state of some specific bits in a bit pattern. For exam-
ple, ~x&1024 will set register x to 1024 if bit 10 (1024=2^10) of register x is on; otherwise,
register x is set to 0.

• Bitwise OR (reg=int(reg ) | int(value ))


This operation is useful for the creation of a bit pattern. For example, ~x|3 will set on bits 0
and 1 of register x (since 3=2^0 + 2^1).

For floating point registers, note that :

• When floating point values are used in a bitwise operation, these values are first converted to
integer before the operation is actually performed, and the floating point register is set to the
value of the resulting integer.

• Each floating point register contains a single precision (32-bit) floating point value, which
– 38
implies that its precision is limited to 6 or 7 digits and the range is approximately 1.17 ×10
38
to 3.40 ×10 (see Computation limitations on page 3-30).

• Floating point registers can be used to hold integer values and to perform arithmetic using
integers. However, when handling large numbers (>4194303), rounding errors might occur.
In this case, it is better to use the generic integer registers x, y and z, which can hold integers
up to 2147483647.

• When using conditional commands on floating point registers, care should be taken in the
equality comparison. Fractional values that are the result of floating point operations are sub-
ject to rounding errors.

• Whenever a floating point value is converted from its binary form to a decimal representation
(or vice versa), rounding errors can occur. This occurs in substitutions and, for rX registers,
when the macro changes modules or calls nested macros, in which case the rX values are
written in the file usemacro as decimal values.

• The use of engineering notation (switch 22 on) can reduce the risk of generating format over-
flows when large floating point values are displayed (or converted to decimal representation).

For global floating point registers gX, note that :

• Although g-registers can be used to store the results of arithmetic operations, they are mainly
used to access the get/put stack values or the third dimension coefficients.

• G-registers are initialized to zero whenever a new module is entered. If the values are to be
used after exiting the module, they must be copied to registers rX or to an external file (see
Reading/writing to external files on page 5-10). For example :

Save the values of gX in rX ~z=0


~+;~z+1;~rz=%%%gz%%%;~?z<250;~$

Write the values of gX to ~+;~z=0


ext_file ~+;~z+1;~>>ext_file;~"%%%z%%% %%%gz%%%;~>>;~?z<250;~$

5-14 2007/02/23
Emme Prompt Manual Macro registers

• Register ‘o’

Register o can be used to control the dialog output (for example, hiding parts of the standard dia-
log in order to generate customized dialog where necessary). Since disabling the dialog also
turns off the standard erasing of the terminal, it is also possible to erase the screen by setting the
o register.

The setting of the o register takes effect immediately and remains until the macro is completed or
until the register is reset (by the macro or automatically). However, it is recommended that bit 0 of
register o only be set at the beginning of a module (Primary select ) or at the main menu level
since, for some sub-dialogs, the effect is delayed until the end of the sub-dialog.

Register o is interpreted as a bit pattern. By default, all bits are off. The action of setting the indi-
vidual bits is described in Table 5.4. The bits marked with a ✓ are automatically reset (set off) as
soon as the desired operation is completed. Bit number n can be set by using the corresponding
decimal value (2^n ) in a macro command, for example ~o|8 sets bit 3.

The option to redirect the dialog output to a temporary scratch file (bit 0 on) together with the func-
tions provided by bits 9 through 12 enable a macro to process a section of dialog output. The out-
put can be read into the global text register t9 by setting bit 11 of the o register.

The o register can also be used to run a macro in a step-by-step mode to facilitate macro debug-
ging (see Single step tracing mode for macro debugging on page 5-18).

Table 5.4 Action of bits of register ‘o’

Bit Decimal Value Action when set

0 1 Suppress standard dialog. The output is directed to a scratch file,


which is automatically erased at the end of each module.

1 2 Suppress comment prefix (~/ and ~~/).

2 4 Suppress echo of macro input (answers preceded by <).

3 8 Set macro in single step tracing mode (see page 5-18).

4 16 Fallback to single step tracing mode (see page 5-18).

5 32 Suppress programmed pauses.

6 64 Read extra input line before programmed pauses and before leaving a
module.

7 128 Automate graphical input sequences from within a macro (see


Section 5.1.3)

8 ✓ 256 Erase terminal screen.

9 ✓ 512 Rewind the scratch file.

10 ✓ 1024 Backspace one record in the scratch file.

11 ✓ 2048 Read the next record from the scratch file into register t9.

12 ✓ 4096 Close and discard current scratch file.

13 ✓ 8192 Read plot area and window coordinates and write to text register t9
(see Section 5.1.3)

2007/02/23 5-15
Macro Language Emme Prompt Manual

Register ‘p’

Register p provides read-only access to global and scenario parameters (refer to Appendix C for
the description of these parameters) and to certain system parameters described below. The use
of the p register is slightly different from other numeric registers : p is assigned the address of the
parameter to be accessed (using the standard register commands ~p=N, ~p+N, etc.). When %p%
is used, the value of the specified parameter is substituted (not its address). For example, ~p=51
sets p to 51 but ~z=%p% sets register z to the value of global parameter 51, that is, the maximum
number of scenarios which can be defined in the database. In conditional macro commands
(~?reg ⊗ N ), the integer N is compared to the value of the parameter accessed by p (not the
value of p itself). For example, if p=51, the test ~?p=4 compares the value of global parameter 51
to 4. The addresses and parameters accessible via the p register are listed in Table 5.5.

The following illustrates a macro containing a command escape to remove the reports file. The p
register is set to the address 2004 which contains the type of operating system. It is then possible
for the macro to execute the appropriate “remove” command, depending on the operating system
on which the macro is running :

Macro for executing a ~! ~p=2004


command escape depending ~?p=1 /UNIX
~!rm reports
on the host OS
~?p=2 /DOS
~!del reports

Table 5.5 Contents of register ‘p’

Address Contents

1-80 Global parameters : for example, database dimensions, report page number,
terminal, report and plot file used. See Global parameters on page C-6.

101-200 External scenario numbers : 0= scenario slot empty (currently not defined),
–1=scenario slot not available in database (slots 101+maximum number of sce-
narios to 200).
1001-1080 Scenario parameters (parameter number + 1000) : for example, assignment
stopping criteria. See Scenario parameters on page C-10.

1081-1280 Extended scenario parameters (parameter number + 1080): for example,


modes used in multiclass assignment. See File 55 on page C-26.

2001 and up System parameters :

2001 Software type (1=Emme, 2=STAN).

2002 Licence number (for example, 623 for licence E623).

2003 Licence size (1-24).

2004 Host operating system (1=UNIX, 2=DOS)

2005 Cumulative CPU time (in 1/10 secs) since creation of database (or since reset).

2006 Current year (2-digits yy, switch 25 off; 4-digits yyyy, switch 25 on)

2007 Current month of year (1-12).

2008 Current day of month (1-31).

2009 Hours of current time of day (0-23).

5-16 2007/02/23
Emme Prompt Manual Macro registers

Table 5.5 Contents of register ‘p’ (continued)

Address Contents

2010 Minutes of current time of day (0-59).

2011 Seconds of current time of day (0-59).

2012 Current database size in (4 byte) words

2013 Database directory size in (4 byte ) words

2014 Maximum number of internal files

2015 Maximum number of records

2016 Maximum number of (4 byte) words per record

2017 Maximum number of file types

2018 Maximum database size in (4 byte) words

2021 No. of logarithms of non-positive number detected in current module

2022 No. of division by zero detected in current module

2023 No. of fractional power of negative number detected in current module

2024 No. of invalid operators detected in current module (internal error)

2025 No. of invalid error checks detected in current module (internal error)

2026 No. of log gamma of non-positive number detected in current module

2027 No. of modulo zero detected in current module

2028 No. of square roots of negative number detected in current module

2029 No. of accesses to non-existing scalars detected in current module

2030 No. of get()/put() stack overflows detected in current module

2031 No. of invalid operation results (NaN) detected in current module

2032 No. of invalid values (NaN) formatted in current module

2033 No. of output format overflows (***) detected in current module

2101 Maximum number of network scenarios

2102 Maximum number of zones or centroids

2103 Maximum number of nodes including centroids

2104 Maximum number of directional links

2105 Maximum number of turn table entries

2106 Maximum number of vehicle types

2107 Maximum number of transit lines or routes

2108 Maximum number of transit line segments

2109 Maximum number of matrices of type mf

2110 Maximum number of matrices of type mo

2111 Maximum number of matrices of type md

2112 Maximum number of matrices of type ms

2007/02/23 5-17
Macro Language Emme Prompt Manual

Table 5.5 Contents of register ‘p’ (continued)

Address Contents

2113 Maximum number of functions per function class

2114 Maximum number of operators per function class

2115 Maximum number of words for log book

2116 Maximum number of demarcation entries per set

2117 Maximum number of words for extra attributes per scenario

2118 Node labels available (0=no, 1=yes)

2119 User data on transit segments available (0=no, 1=yes)

2120 Internal file for class specific auto volumes available (0=no, 1=yes)

2121 Size of temporary storage file 95 in 32-bit words

5.1.2 Single step tracing mode for macro debugging

Single step tracing mode (or debug mode) can ease the process of macro debugging by allowing :

• Execution of a macro in a step-by-step mode, prompting the user before each macro line (dis-
played on the terminal) is executed

• Inspection of all registers, and changing their values if necessary

• Listing of the contents of the macro

• Inspection of current position at all macro call levels

• Temporary corrections such as skipping, inserting or replacing lines

• Error recovery by falling back to single step tracing mode in case of error or interruption

• Single step tracing mode is activated by setting bit 3 of the o register on. When activated, this
mode takes effect at the level of each macro line echoed on the dialog output with <… (the echo
of a macro line depends on the setting of switch 15, and of bits 1 and 2 of register o). Each macro
line that is subject to debug mode is displayed as usual, followed by the corresponding macro line
number between tildes (or ~Line : character~ for compound macro commands). The user must
enter a carriage return (↵) to process the line.

Example of a macro in single Enter: Width,height of nodes without node number


step tracing mode ( 4.00, 4.00)= < 4.0,4.0 ~L15 ~ ↵
Enter: Width,height of nodes with node numbers
( 32.00, 12.00)= < 32.0,12.0 ~L16:04 ~ ↵
Enter: Offset to the right for links ( 1.80)= < 3.0 ~L16:15 ~ ↵

• At the debug mode prompt ~, it is possible to enter one of the debugging commands described in
Table 5.6. These commands allow the contents of the registers to be displayed and modified.
Setting the value of t0 also implies that the macro parameters %1%, %2%, … are changed.
The :r, :s, and :i commands allow limited editing of the dialog input generated by the macro.
Thus, the macro can continue even after a problem has occurred. The changes do not become
part of the macro. Note that the entire debugging command is subject to macro substitution, that
is, %…% sequences will be substituted as if they appeared in the macro itself.

5-18 2007/02/23
Emme Prompt Manual Generate graphical input sequences from within a macro

• Bit 4 of the o register functions as a “fallback to debug mode” flag. If bit 4 is set, and an error or an
interrupt occurs during macro execution, macro processing continues but single step tracing mode
is entered. This feature can be very useful when updating macros for new releases. To
leave debug mode and return to fallback mode use the continue command (:c).

The o register value is local to each called macro (see Nested macros on page 5-9). Therefore,
the :c command only takes effect within the current macro so that execution can be “continued”
through a called sub-macro but will return to single step tracing mode in the calling macro.

Table 5.6 Debugging commands in single step tracing mode

Command Action

↵ Execute the current answer or macro command.

reg Display current value of the macro register reg (numeric or text).

reg=value Set value of writable macro register reg (numeric or text).

* Display the current values of all integer registers.

r (or r*) Display the current values of all non-zero floating point registers.

g (or g*) Display the current values of all non-zero global numeric registers.

t (or t*) Display the current values of all text registers.

:c Continue macro without single stepping; o register bit 3 is reset and bit 4 (fallback)
is set.

:i text Insert text as an answer before the current line (not valid in compound commands).

:l List context around the current line (the three preceding lines, the current line and
the three following lines). The current line is indicated by the character >.

:lN List N following (N > 0) or preceding (N < 0) lines in macro, including the current
line.

:p Give line numbers and file names of all macros currently active.

:r text Replace the current answer by text.

:s Skip the current answer (not valid for compound commands).

:x Exit macro mode.

? Display the list of debugging commands.

5.1.3 Generate graphical input sequences from within a macro

To automate graphical input, or GIN, sequences from within a macro, bit 7 of the o register must
be set. When bit 7 is set and the macro comes to a point in a module where it would normally dis-
play the crosshair cursor in a plot or interactive graphic worksheet to wait for a GIN sequence,
then:

• the crosshair cursor is not displayed

• the macro continues until the next answer line

2007/02/23 5-19
Macro Language Emme Prompt Manual

• this line is parsed using Emme free format rules for the fields x y char hu, where:

x X-coordinate (real number, default 0.00)


y Y-coordinate (real number, default 0.00)
char GIN command (an ASCII character, in single quotes when desired or needed to
avoid conflicts with the free format rules, by default a blank is assumed)
hu Identifies the coordinate system (hardware or user) for the X-Y coordinates:
hu=0 hardware coordinates (default)
hu=1 user coordinates (only valid on plots for which the user coordinates are
defined)

• if the coordinates specified are user coordinates, they are converted to hardware coordinates

• the resulting hardware coordinates and GIN command are returned to the calling module, as
if they would have been entered manually with the crosshair cursor.

• If an error is detected when parsing the line, for example, the contents of the line does not
match the specified format or the coordinates are not within the screen viewport, an error is
generated.

For example, the following macro sequence is used to generate a transcript file in Module 6.15
containing paths from node 4 to all other nodes using GIN sequences. First the path from node 4
to node 118 (X-Y coordinates 633784, 5535117), then all paths from node 4 are sent to the tran-
script file. Note, the module parameter Generate transcript of interactive queries into the batch
output file? must be set to yes to be able to write path information to the specified transcript file.

Example of an automatic ~o+128


GIN sequence m=6.15
~# change module parameters, allow paths to/from all nodes, ask for transcript
~# file
~+;4;;;;;y;y;n
~# display all auto paths from node 4 using a 5 min. interval
~+;2;c;1;4;all;5;n;all;n;n
~# enter interactive query mode using 'c' graphic command
c
~# use new GIN sequences to send path information to transcript file
~# send path from node 4 to node 118 to transcript file
633784 5535117 ' ' 1
~# send all paths from node 4 to transcript file
0 0 b
~# return to graphic command level
0 0 g
q

Accessing plot area and window coordinates from within a macro

With the possibility of generating GIN sequences from within macros, it is also possible to obtain
information on the active plot area (or viewport) and the corresponding window. This information
would make it possible to determine the enlargement scale used in a plot, or to determine if a
given point is contained within the current window or not.

To obtain the current plot area and window coordinates from within a macro, bit 13 of
the o register must be set. When this bit is set, the coordinates are returned to text register t9 in
the order shown below, and bit 13 is reset.

xhl yhl xhh yhh xul yul xuh yuh

5-20 2007/02/23
Emme Prompt Manual Tips on macros

where (xhl, yhl ) and (xhh, yhh) are the hardware coordinates of the lower left and upper right
corners of the current plot area, and (xuh, yuh) and (xuh, yuh) are the user coordinates of the
lower left and upper right corners of the current window. Note that this information should only be
retrieved while the module is in graphic mode.

5.1.4 Tips on macros

• Comment your macros


Comment lines can be included by using the commands ~#, ~/ or ~~/ (see page 5-4). Com-
ments can also be added after a slash (/) terminating an input record (see Emme free format on
page 3-28), except on label (~:) and branch (~$) command lines.

• Generate log book comments


Use the log book to trace calls of macros which modify the database by using the menu command
c= at the beginning and at the end of a macro. For example, begin a macro with the line
c=calling macro: macroname %t0%
and end the macro with the line
c=end of macro macroname

• Use scalars ms90 … ms99 for temporary results


Reserve scalars ms90 … ms99 to store temporary results for local use by macros. Do not use
these matrices to hold permanent application specific data. This facilitates the sharing of
macros.

• Use temporary or extra attributes for temporary vector results


Store temporary vector results in temporary network attributes, if these results are limited to use
within the network calculator, or in extra attributes named @tmp…, if these results are used in
other modules.

• Test for the presence of the required parameters


When a macro requires a certain number of parameters, add a test at the beginning of the macro
to verify if enough parameters are provided. If not, the macro should issue a message showing a
summary of the usage of the macro.

• Test for assignment results


When a macro only makes sense if called from a scenario containing a valid auto or transit
assignment, test the f register (see Macro registers on page 5-11) at the beginning of the macro
to verify that the scenario indeed contains the required assignment.

• Test for operating system when using ~! commands


When external commands (~!…) are to be executed by the operating system of the host com-
puter, add a test to generate the command appropriate for the OS (see Register ‘p’ on
page 5-16).

• Suppress standard dialog


To suppress the dialog questions and answers normally generated by a macro, set bits 0, 1 and 2
of the o register (~o=7). Only the comment lines (with the ~/ removed) will appear on the
terminal. Since it is difficult to debug a macro once the dialog is hidden in this way, it is recom-
mended that switch 15 (dialog/macro echo mode ) be tested before setting the o register. Then
the macro will run in “quiet” mode if switch 15 is off, and in normal mode if switch 15 is set.

• Suppress unnecessary pauses


To speed up macros that send many short reports to the report file, set bit 5 of the o register to
suppress the 2 second pause that normally occurs at the end of each report.

2007/02/23 5-21
Macro Language Emme Prompt Manual

• Suppress unwanted reports


When the reports normally produced are not needed, set the report file name to the null device of
the operating system, that is, NUL (Windows), /dev/null (UNIX).

• Restore file names


When using the menu commands batchin=, batchout=, plots= and reports=, restore the original
file names before the end of the macro using the file name specification ^ (see File naming of
input and output on page 3-30).

• Restore state of switches


At the end of a macro, reset to its initial value any switch that has been modified. To save the ini-
tial state of all switches, save the value of the switch register i at the beginning of the macro.

Macro updates

• Quit modules with q


Exit a module using q instead of the number that currently corresponds to the option end in the
Primary select. This ensures compatibility when new options are added to the Primary select.

• Run in debug mode


Running an existing macro in debug mode facilitates the task of updating macros when installing a
new release. By adding the line ~o|16 at the beginning of any macro, it is easy to find where
modifications are needed when using an existing macro for the first time with a new release.
Alternatively, the macro debug.mac (located in the macros subdirectory) can be used as a
“wrapper” to call another macro, together with its parameters, and run it in debug mode. Use the
debugging command :c (see Table 5.6) so that the macro will continue without single stepping
unless an error occurs.

• Test the version register


When updating macros for new releases, conditional macro commands and the v macro register
(see Read-only registers on page 5-11) can be used to maintain macro compatibility with previous
releases. For example, to update macros for Release 7.0, dialog input lines which are added to
the macro can be preceded by the conditional command ~?v>700, while lines which were
needed for previous releases, but must be removed for the new Release, can be preceded by
~?v<700. Refer to Tests in macros on page 5-7, for more information on conditional macro com-
mands.

5-22 2007/02/23
Emme Prompt Manual Supported Macros

5.2 Supported Macros

The macros distributed in the macros directory of the Emme program environment are part of the
Emme system like any program distributed in the programs directory. INRO supports these
macros in their original form only and is not responsible for any variants.

5.2.1 Modifydb : modify dimensions of an Emme database

When an Emme database is created, the database dimensions are specified by the user. The
macro modifydb, located in the macros subdirectory, provides a means for subsequently chang-
ing some of these dimensions.

The dimension to be modified and its associated values are specified as macro parameters : a
keyword which specifies the dimension, followed by values that specify the change. Any increase
must remain within the maximum dimensions allowed by the Emme licence size. These dimen-
sions appear in parenthesis in the dialog when creating a new database (see Module 0.01). Note
that the size of the resultant database is also subject to the usual restrictions on database size
(see Database size on page 2-11). Since modifydb does not test the size of the resultant data-
base, it is possible to create a database which will be unusable.

Since the modify operation will result in a larger database, it is the user’s responsibility to make
sure that enough disk space is available. Also note that the operation of this macro should never
be interrupted, as it might leave the database in an unusable state. ALWAYS MAKE A COM-
PLETE BACKUP OF THE DATABASE BEFORE RUNNING THIS MACRO!!!

modifydb is called in the same way as any other Emme macro (see Calling a macro via the
Emme command on page 2-5, and Saving and recalling macros on page 3-20). Note that this
macro cannot be run on EMME/2 systems, Release 5.2 and earlier. Also, it is recommended
switches 15 and 30 be set to off before running this macro. If switch 15 is on, the macro will gen-
erate voluminous output (standard dialog). If switch 30 is on, the macro will generate a large
number of diagnostic error messages in the errors file.

Once the macro starts to modify the database, a message warns the user not to interrupt the
macro. Some of the changes are time-consuming and the user should always wait for the final
summary message which indicates that the dimension(s) has been changed (see following
examples).

Modifydb keywords and option values

The first macro parameter is a keyword that defines which dimension(s) to modify. A call to mod-
ifydb can contain only one keyword. Available keywords are :

• morescen : increase maximum number of scenarios (see page 5-25)

• morelink : increase maximum number of directional links (see page 5-26)

• morenode : increase maximum number of regular nodes (see page 5-27)

• morevehs : increase maximum number of transit vehicles (see page 5-28)

• moreline : increase maximum number of transit lines (see page 5-28)

• moresegs : increase maximum number of transit segments (see page 5-29)

• moreturn : increase maximum number of turn table entries (see page 5-30)

2007/02/23 5-23
Supported Macros Emme Prompt Manual

• moremat : increase maximum number of matrices (see page 5-31)

• morefunc : increase maximum number of functions and/or operators (see page 5-32)

• morextra : increase size of extra attribute table (see page 5-34)

• addus123 : add segment user data items (see page 5-33)

• addlabel : add node labels (see page 5-33)

• logbook : change size of log book (see page 5-34)

Most options require the user to specify the old and new values for the dimension(s) to be
changed. Note that the new value must be greater than the old value but should not exceed the
maximum allowed by the Emme licence size. The values follow the keyword and are separated by
blanks. (Note that, a value must be specified as a string of digits, without separator; for example,
4000 but not 4,000 or 4 000.) The values denoted as current can be obtained using the dim menu
command.

If an option is called with the keyword only, a short explanatory message, giving more detailed
information regarding the option, is displayed.

Enter: Next module=device

Enter: Next module=~<modifydb morescen


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb called ******MORESCEN: INCREASE NUMBER OF SCENARIOS IN A DATABASE**********
*** ***
with a keyword only
*** This Emme macro can be used to increase the maximum no. ***
*** of scenarios that can be stored in an existing database. ***
*** This is done using module 1.11 for modifying the dimensions ***
*** of all applicable internal files. Depending on the size ***
*** of the database , this operation can be quite lengthy. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that enough disk space is available to ***
*** hold the additional scenarios. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
*** ***
*** Usage: ~<modifydb morescen <old> <new> ***
*** where <old>: current number of scenarios in database ***
*** <new>: new number of scenarios in database (new>old) ***
*** ***
**********************************************************************

Once the modifydb keywords and values have been verified, the user is asked to confirm the
dimension changes.

When increasing the number of nodes, links and segments, the extra attributes for the corre-
sponding elements are added automatically, using the default extra attribute value, for all
scenarios. If the extra attribute table of a scenario is too full to be adjusted, an error message is
generated and the user has to adjust the extra attribute table of this scenario manually (using
Module 2.42). The user may delete unnecessary attributes or increase the size of the extra
attribute table (using the option morextra of modifydb) before doing the adjustment in
Module 2.42. It is essential to perform this adjustment before making any network modification.

5-24 2007/02/23
Emme Prompt Manual Modifydb : modify dimensions of an Emme database

Example 2.1.1 Increase number of scenarios

Macro command :
~<modifydb morescen oldscen newscen

Option values :
oldscen : current maximum number of scenarios in database
newscen : new maximum number of scenarios in database

The following example increases the maximum number of scenarios in the database from 3 to 5.

Enter: Next module=device

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

*** Copyright (C) 2006 INRO. All rights reserved. ***


******MORESCEN: INCREASE NUMBER OF SCENARIOS IN A DATABASE**********
Output from modifydb: *** ***
*** This Emme macro can be used to increase the maximum no. ***
add more scenarios
*** of scenarios that can be stored in an existing database. ***
*** This is done using module 1.11 for modifying the dimensions ***
*** of all applicable internal files. Depending on the size ***
*** of the database, this operation can be quite lengthy. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that enough disk space is available to ***
*** hold the additional scenarios. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase number of scenarios from 3 to 5. This operation


will increase the size of the database by approximately 1132840 bytes.
Do you really want to proceed?y
`MODIFYDB MORESCEN 3 5’ is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal files
...file 1
...file 2
...file 5
...file 6
...file 9
...file 11
...file 12
...file 13
...file 14
...file 15
...file 17
...file 18
...file 19
...file 20
...file ...
...file 58
...file 59
...file 7
...file 10
...file 8
...file 16
...file 39
...file 46
2) Shifting records in files 7, 8, 10, 16, 39 and 46
...record 3
...record 2
...record 1
3) Updating global parameter MSCEN from 3 to 5

**********************************************************************
Wait for this message → MACRO "MODIFYDB MORESCEN" HAS COMPLETED NORMALLY. THE DATABASE
NOW ALLOWS A MAXIMUM OF 5 SCENARIOS (PREVIOUSLY 3).
**********************************************************************

2007/02/23 5-25
Supported Macros Emme Prompt Manual

Example 2.1.2 Increase number of directional links

Macro command :
~<modifydb morelink oldlink newlink

Option values :
oldlink : current maximum number of links
newlink : new maximum number of links

The following example will increase the maximum number of links from 3000 to 3500.

Enter: Next module=device

Enter: Next module=~<modifydb morelink 3000 3500


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******MORELINK: INCREASE NUMBER OF LINKS IN DATABASE ****************
*** ***
add more directional links
*** This Emme macro can be used to increase the maximum ***
*** number of links in the current database. This is ***
*** done using module 1.11 for extending the corresponding ***
*** internal files 11 to 21 to the appropriate dimensions. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase maximum number of links from 3000 to 3500.


This operation will increase the size of the database by approximately
130000 bytes.
Do you really want to proceed?y
`MODIFYDB MORELINK 3000 3500’ is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal files
...file 11
...file 12
...file 13
...file 14
...file 15
...file 17
...file 18
...file 19
...file 20
...file 21
...file 16
2) Shifting records to correct position and initializing gaps
...record 15
...record 14
...record 13
...record ...
...record 1
3) Redefining record structure of internal files
...file 11
...file 12
...file 13
...file ...
...file 16
...file 98
4) Set global parameter MLINK to 3500

Checking extra attribute table (DO NOT INTERRUPT!):


Scenario 1000: No adjustment needed.
Scenario 2000: No adjustment needed.

**********************************************************************
Wait for this message → MACRO MORELINK HAS COMPLETED WITH 0 ERRORS. THE DATABASE
NOW ALLOWS A MAXIMUM OF 3500 LINKS (PREVIOUSLY 3000).
**********************************************************************

5-26 2007/02/23
Emme Prompt Manual Modifydb : modify dimensions of an Emme database

Example 2.1.3 Increase number of regular nodes

Macro command :
~<modifydb morenode oldnode newnode

Option values :
oldnode : current maximum number of nodes (including centroids)
newnode : new maximum number of nodes (including same number of centroids)

The following example will increase the maximum number of nodes (including centroids) from
1200 to 1500. Note that, both the current and new number of nodes include centroids and only
the maximum number of regular nodes increases.

Enter: Next module=device

Enter: Next module=~<modifydb morenode 1200 1500


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******MORENODE: INCREASE NUMBER OF NODES IN DATABASE ****************
*** ***
add more regular nodes
*** This Emme macro can be used to increase the number of ***
*** regular network nodes in the current database. This is ***
*** done using module 1.11 for extending the corresponding ***
*** internal files 6 to 10 and 22 to the appropriate dimensions. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase maximum number of nodes from 1200 to 1500.


This operation will increase the size of the database by approximately
60000 bytes.
Do you really want to proceed?y
`MODIFYDB MORENODE 1200 1500' is now running - DO NOT INTERRUPT!!!

1) Adjusting size of internal files


...file 6
...file 9
...file 22
...file 7
...file 10
...file 8
2) Shifting records to correct position and initializing gaps
...record 15
...record 14
...record 13
...record ...
...record 1
3) Redefining record structure of internal files
...file 6
...file 9
...file 22
...file 7
...file 10
...file 8
4) Set global parameter MNODE to 1500

Checking extra attribute table (DO NOT INTERRUPT!):


Scenario 1000: No adjustment needed.
Scenario 2000: No adjustment needed.

**********************************************************************
Wait for this message → MACRO MORENODE HAS COMPLETED WITH 0 ERRORS. THE DATABASE
NOW ALLOWS A MAXIMUM OF 1500 NODES (PREVIOUSLY 1200).
**********************************************************************

2007/02/23 5-27
Supported Macros Emme Prompt Manual

Example 2.1.4 Increase number of transit vehicles

Macro command :
~<modifydb morevehs oldvehs newvehs

Option values :
oldvehs : current maximum number of transit vehicles
newvehs : new maximum number of transit vehicles (must not exceed 999)

The following example will increase the maximum number of transit vehicles from 30 to 50.

Enter: Next module=device

Enter: Next module=~<modifydb morevehs 30 50


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******MOREVEHS: INCREASE NUMBER OF MORE TRANSIT VEHICLES*************
*** ***
add more transit vehicles
*** This Emme macro can be used to increase the max. number ***
*** of transit vehicles in the current database. This is ***
*** done using module 1.11 for extending the corresponding ***
*** internal file 30 to the appropriate dimensions. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase max. no. of transit vehicles from 30 to 50.


This operation will increase the size of the database by 5600 bytes.
Do you really want to proceed?y
'MODIFYDB MOREVEHS 30 50' is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal file 30
2) Shifting records to correct position and initializing gaps
...record 5
...record 4
...record 3
...record 2
...record 1
3) Redefining record structure of internal file 30

**********************************************************************
Wait for this message → MACRO MOREVEHS HAS COMPLETED NORMALLY. THE DATABASE NOW
ALLOWS A MAXIMUM OF 50 TRANSIT VEHICLES (PREVIOUSLY 30).
**********************************************************************

Example 2.1.5 Increase number of transit lines

Macro command :
~<modifydb moreline oldline newline

Option values :
oldline : current maximum number of transit lines
newline : new maximum number of transit lines

The following example will increase the maximum number of transit lines from 150 to 250.

5-28 2007/02/23
Emme Prompt Manual Modifydb : modify dimensions of an Emme database

Enter: Next module=device

Enter: Next module=~<modifydb moreline 150 250


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******MORELINE: INCREASE NUMBER OF TRANSIT LINES*********************
*** ***
add more transit lines
*** This Emme macro can be used to increase the max. number ***
*** of transit lines in the current database. This is done ***
*** using module 1.11 for extending the corresponding internal ***
*** files 31 and 32 to the appropriate dimensions. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase max. no. of transit lines from 150 to 250.


This operation will increase the size of the database by 50000 bytes.
Do you really want to proceed?y
`MODIFYDB MORELINE 150 250' is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal files 31 and 32
2) Shifting records to correct position and initializing gaps
...record 5
...record 4
...record 3
...record 2
...record 1
3) Redefining record structure of internal files 31 and 32
4) Set global parameter MLINE to 250

Checking extra attribute table (DO NOT INTERRUPT!):


Scenario 1000: No adjustment needed.
Scenario 2000: No adjustment needed.

**********************************************************************
Wait for this message → MACRO MORELINE HAS COMPLETED WITH 0 ERRORS. THE DATABASE NOW
ALLOWS A MAXIMUM OF 250 TRANSIT LINES (PREVIOUSLY 150).
**********************************************************************

Example 2.1.6 Increase number of transit segments

Macro command :
~<modifydb moresegs oldsegs newsegs

Option values :
oldsegs : current maximum number of transit segments
newsegs : new maximum number of transit segments

The following example will increase the maximum number of transit segments from 5000 to 6000.

2007/02/23 5-29
Supported Macros Emme Prompt Manual

Enter: Next module=device

Enter: Next module=~<modifydb moresegs 5000 6000


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******MORESEGS: INCREASE NUMBER OF TRANSIT SEGMENTS******************
*** ***
add more transit segments
*** This Emme macro can be used to increase the max. number ***
*** of transit segments in the current database. This is ***
*** done using module 1.11 for extending the corresponding ***
*** internal files 33 to 39 to the appropriate dimensions. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase max. no. of transit segments from 5000 to 6000.


This operation will increase the size of the database by approximately
180000 bytes.
Do you really want to proceed?y
`MODIFYDB MORESEGS 5000 6000’ is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal files
...file 33
...file 34
...file 35
...file 36
...file 37
...file 38
...file 39
2) Shifting records to correct position and initializing gaps
...record 15
...record 14
...record 13
...record ...
...record 1
3) Redefining record structure of internal files
...file 33
...file 34
...file 35
...file 36
...file 37
...file 38
...file 39
4) Set global parameter MLSEG to 6000

Checking extra attribute table (DO NOT INTERRUPT!):


Scenario 1000: No adjustment needed.
Scenario 2000: No adjustment needed.

**********************************************************************
Wait for this message → MACRO MORESEGS HAS COMPLETED WITH 0 ERRORS. THE DATABASE NOW
ALLOWS A MAXIMUM OF 6000 TRANSIT SEGMENTS (PREVIOUSLY 5000).
**********************************************************************

Example 2.1.7 Increase number of turn table entries

Macro command :
~<modifydb moreturn oldturn newturn

Option values :
oldturn : current maximum number of turn table entries
newturn : new maximum number of turn table entries

The following example will increase the maximum number of turn table entries from 1000 to 1200.

5-30 2007/02/23
Emme Prompt Manual Modifydb : modify dimensions of an Emme database

Enter: Next module=device

Enter: Next module=~<modifydb moreturn 1000 1200


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******MORETURN: INCREASE NUMBER OF TURN TABLE ENTRIES****************
*** ***
add more turn table entries
*** This Emme macro can be used to increase the number of ***
*** turn table entries in the current database. This is ***
*** done using module 1.11 for extending the corresponding ***
*** internal files 41 to 46 to the appropriate dimensions. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase number of turn table entries from 1000 to 1200.


This operation will increase the size of the database by approximately
32000 bytes.
Do you really want to proceed?y
`MODIFYDB MORETURN 1000 1200’ is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal files
...file 41
...file 42
...file 43
...file 44
...file 45
...file 46
2) Shifting records to correct position and initializing gaps
...record 15
...record 14
...record 13
...record ...
...record 1
3) Redefining record structure of internal files
...file 41
...file 42
...file 43
...file 44
...file 45
...file 46
...file 99
4) Set global parameter MTURN to 1200

Checking extra attribute table (DO NOT INTERRUPT!):


Scenario 1000: No adjustment needed.
Scenario 2000: No adjustment needed.

**********************************************************************
Wait for this message → MACRO MORETURN HAS COMPLETED NORMALLY. THE DATABASE NOW ALLOWS
A MAXIMUM OF 1200 TURN TABLE ENTRIES (PREVIOUSLY 1000).
**********************************************************************

Example 2.1.8 Increase number of matrices

Macro command :
~<modifydb moremat mattyp oldmat newmat

Option values :
mattyp : matrix type (mf, mo, md or ms)
oldmat : current number of matrices of type typ in database
newmat : new number of matrices of type typ in database

2007/02/23 5-31
Supported Macros Emme Prompt Manual

The following example will increase the maximum number of full matrices in the database from 10
to 12.

Enter: Next module=device

Enter: Next module=~<modifydb moremat mf 10 12


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ********MOREMAT: INCREASE NUMBER OF MATRICES IN A DATABASE **********
*** ***
add more matrices
*** This Emme macro can be used to increase the maximum no. of ***
*** matrices that can be stored in an existing database. ***
*** The number of scalars, origin and destination matrices and ***
*** full matrices can be increased up to 999 by the user. ***
*** This is done using module 1.11 for modifying the dimensions ***
*** of the applicable internal files. Depending on the size ***
*** of the database, this operation can be quite lengthy. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that enough disk space is available to ***
*** hold the additional matrices. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase number of mf matrices from 10 to 12.


This operation will increase the size of the database by 217800 bytes.
Do you really want to proceed?y
`MODIFYDB MOREMAT mf 10 12' is now running - DO NOT INTERRUPT!!!
1) Matrix directory size is 99 - no adjustment needed
2) Adjusting full matrices to 12

**********************************************************************
Wait for this message → MACRO "MODIFYDB MOREMAT" HAS COMPLETED NORMALLY. THE DATABASE
NOW ALLOWS FOR: SCALAR MATRICES: ms1 - ms99
ORIGIN MATRICES: mo1 - mo99
DESTINATION MATRICES: md1 - md99
FULL O-D MATRICES: mf1 - mf12
**********************************************************************

Example 2.1.9 Increase number of functions/operators

Macro command :
~<modifydb morefunc oldfnc oldop newfnc newop

Option values :
oldfnc : current maximum number of functions per class
oldop : current maximum number of operators per function class
newfnc : new maximum number of functions per class (must not exceed 99)
newop : new maximum number of operators per function class (must not exceed 2000)

The following example will increase the maximum number of functions per class from 50 to 60 and
the maximum number of operators per function class from 500 to 1000.

5-32 2007/02/23
Emme Prompt Manual Modifydb : modify dimensions of an Emme database

Enter: Next module=device

Enter: Next module=~<modifydb morefunc 50 500 60 1000


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******MOREFUNC: INCREASE NUMBER OF FUNCTIONS AND/OR OPERATORS********
*** ***
add more functions and
*** This Emme macro can be used to increase the number of ***
operators *** functions and/or operators per function class. This is ***
*** done using module 1.11 for extending the corresponding ***
*** internal files 81 and 82 to the appropriate dimensions. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase number of functions/operators per function class


from 50/500 to 60/1000.
This operation will increase the size of the database by 24240 bytes.
Do you really want to proceed?y
`MODIFYDB MOREFUNC 50 500 60 1000' is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal file 81
2) Adjusting size of internal file 82

**********************************************************************
Wait for this message → MACRO MOREFUNC HAS COMPLETED NORMALLY. THE DATABASE NOW ALLOWS
A MAXIMUM OF 60 FUNCTIONS AND 1000 OPERATORS PER FUNCTION CLASS.
**********************************************************************

Example 2.1.10 Add segment user data items

Macro command :
~<modifydb addus123

This command adds segment user data items us1 … us3 to a database that was created without
them. The macro ends with the following message :

modifydb:
add segment user data **********************************************************************
Wait for this message → MACRO ADDUS123 HAS COMPLETED NORMALLY. THE DATABASE NOW
CONTAINS USER SEGMENT DATA ITEMS US1, US2 AND US3.
**********************************************************************

Example 2.1.11 Add node labels

Macro command :
~<modifydb addlabel

This command adds 4-character node labels to a database that was created without them. The
labels are initialized to blanks. The macro ends with the following message :

modifydb:
add node labels **********************************************************************
Wait for this message → MACRO ADDLABEL HAS COMPLETED NORMALLY.
THE DATABASE NOW CONTAINS NODE LABELS (INITIALIZED TO ' ').
**********************************************************************

2007/02/23 5-33
Supported Macros Emme Prompt Manual

Example 2.1.12 Increase size of extra attribute table

Macro command :
~<modifydb morextra oldsize newsize

Option values :
oldsize : current size (in words) of extra attribute table
newsize : new size (in words) of extra attribute table

Note that, while in Module 2.42 the maximum size that can be specified is 536870911 words per
scenario, modifydb will accept a maximum value of 536870911* words for the entire database;
that is, the maximum number of words that can be specified per scenario is 536870911/number of
scenarios.

The following example will increase the size of the extra attribute table from 30825 to 32000,
which allows for the definition of 3 attributes of each type for the Winnipeg demonstration data-
base (see Module 2.42, page 4-141).

Enter: Next module=device

Enter: Next module=~<modifydb morextra 30825 32000


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******MOREXTRA: INCREASE SIZE OF EXTRA ATTRIBUTE TABLE***************
*** ***
increase extra attribute table
*** This Emme macro can be used to increase the size of the ***
*** extra attribute table (words per scenario). This is ***
*** done using module 1.11 for extending the corresponding ***
*** internal files 59 to the appropriate dimensions. ***
*** It is of utmost importance that the procedure is not inter- ***
*** rupted, since this would leave the database in an unusable ***
*** state. Also, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. THUS, ALWAYS MAKE A COMPLETE ***
*** BACKUP OF THE EMMEBANK FILE BEFORE RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to increase the size of the extra attribute table from 30825 to
32000 words per scenario.
This operation will increase the size of the database by 23500 bytes.
Do you really want to proceed?y
`MODIFYDB MOREXTRA 30825 32000' is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal file 59
2) Shifting records in file 59 to correct position and initializing gaps
3) Redefining record structure of internal file 59

**********************************************************************
Wait for this message → MACRO MOREXTRA HAS COMPLETED NORMALLY. THE DATABASE NOW
HAS AN EXTRA ATTRIBUTE TABLE WITH 32000 WORDS PER SCENARIO.
**********************************************************************

Example 2.1.13 Change size of log book

Macro command :
~<modifydb logbook oldsize newsize

* This limit assumes that a database with the 32-bit directory structure (introduced in Release 9) is used. If
using a database which was created with Release 8 or earlier, a more restrictive limit may apply.

5-34 2007/02/23
Emme Prompt Manual Split2layovers: split transit lines with layovers into separate lines

Option values :
oldsize : current size (in words) of log book
newsize : new size (in words) of log book (must not exceed 5000).

When using this option, the contents of the log book are initialized, that is, all existing entries will
be lost. Note that , unlike other options of modifydb, the size of the log book can be increased or
decreased. However, a decrease in the size of the log book does not imply a decrease in the size
of the Emme database, but the space becomes available for further increases.

The following example shows how the macro ends when the size of the log book is decreased
from 1000 to 500 words.

Enter: Next module=device

Enter: Next module=~<modifydb logbook 1000 500


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

******MODIFYDB: MODIFY DIMENSIONS OF AN EMME DATABASE (9.11)******


*** Copyright (C) 2006 INRO. All rights reserved. ***
Output from modifydb: ******LOGBOOK: CHANGE SIZE OF LOG BOOK AND INITIALIZE ITS CONTENTS ***
*** ***
decrease size of logbook
*** This Emme macro can be used to change the size of the ***
*** log book in an existing database. This is done using ***
*** module 1.11 for changing the size of the corresponding ***
*** internal file 91, thereby initializing its contents. ***
*** It is of utmost importance that the procedure is not ***
*** interrupted, since this would leave the database in an ***
*** unusable state. If the size of the log book is to be ***
*** increased, it is up to the user to make sure before ***
*** running this macro that ENOUGH DISK SPACE is available to ***
*** hold the additional data. If the size of the logbook is ***
*** decreased, the size of database file does not actually ***
*** decrease, but the freed up space will be reused when in- ***
*** creasing the next time some database dimensions. ***
*** ALWAYS MAKE A COMPLETE BACKUP OF THE EMMEBANK FILE BEFORE ***
*** RUNNING THIS MACRO!!!!! ***
**********************************************************************

About to change the size of the log book from 1000 to 500. Note that
this operation will initialize the log book so that its current
contents will be lost.
This operation will not actually decrease the size of the database.
The freed up 2000 bytes will only be reused when increasing some database
dimensions later on. (Note that EMXFBANK will report a inconsistent
size error until the freed up space is reused.)

Do you really want to proceed?y


`MODIFYDB LOGBOOK 1000 500' is now running - DO NOT INTERRUPT!!!
1) Adjusting size of internal file 91

**********************************************************************
Wait for this message → MACRO "MODIFYDB LOGBOOK" HAS COMPLETED NORMALLY. THE LOGBOOK HAS
BEEN INITIALIZED AND ITS SIZE HAS BEEN CHANGED FROM 1000 TO 500.
**********************************************************************

5.2.2 Split2layovers: split transit lines with layovers into separate lines

A transit line itinerary can have a maximum of two layovers: one intermediary layover and one at
the end of the itinerary. However, more useful statistics are available when lines are coded by
direction, that is, with only layover at the end.

The Emme GUI detects when a transit line that is being edited has more than one layover. The
user is recommended to split the itineraries such that each itinerary has only one layover.

2007/02/23 5-35
Supported Macros Emme Prompt Manual

The split2layovers macro, located in the macros subdirectory, can be used to split a transit
line itinerary with two layovers into two, distinct lines. The split2layovers macro is a
user-friendly interface for the SPLIT2LAYOVERS utility (see Section 7.3). At the end of the
line-splitting procedure, the new set of transit lines is stored in a batch input file called
split2layovers.in. The user has the option of replacing the current set of transit lines with
the new set in the current and/or in another scenario using a second macro,
replace2layovers, which is called by the split2layovers macro.

split2layovers is called like any other macro (see Saving and recalling macros on
page 3-20).

Enter: Next module=device

Current terminal type is: Emtool


Change? n

Current printer type is: ASCII printer 60 lines

~<split2layovers
Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

• The user will be asked to specify two single-character suffixes to append to the original transit line
name and to the description for the new, split lines.

• The first suffix is used to denote the first part of the itinerary until the layover; the default suffix
for the first part of the itinerary is a blank.

• The second suffix is used to denote the transit line itinerary after the layover; the default suffix
for the second part of the itinerary is the # character.

Any character may be used, however it is recommended to avoid the following characters, as
they may be special characters for certain operating systems: ^ & * | " < >.

• Lines that do not contain any intermediary layover are preserved in the new set of transit lines.

• The split2layovers macro does not handle extra attributes.

• Transit line names can have a maximum of six characters. If the name of at least one of the transit
lines in the existing set of transit lines is six characters, the following warning message is dis-
played:

Enter: Next module=device

. ### WARNING: Transit lines with 6-character names will be split! ###
Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

.
. The new transit line names must be adjusted before they are replaced!
. Shorten the transit line names in the new transit line file
. "split2layovers.in" and then call the macro "replace2layovers".
.
. Would you like to generate the "split2layovers.in" file anyway (y/n)?

If the user decides to continue, the lines will be split, and the macro will display the line names that
must be shortened at the end of the line-splitting procedure. He can then proceed to edit the new
transit line file split2layovers.in, as specified in the message.

• If the database does not have enough space to store the resulting split transit lines and/or transit
segments, the user is warned that he must change the dimensions of the database before he can
read in the new set of transit lines in split2layovers.in. Once the database has been cor-
rectly dimensioned using the modifydb macro (see examples 2.1.5 and 2.1.6), the user can use
the replace2layovers macro to read in the new set of transit lines.

5-36 2007/02/23
Emme Prompt Manual Split2layovers: split transit lines with layovers into separate lines

Enter: Next module=device

Current terminal type is: Emtool


Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

. ### WARNING: The new set of transit lines contains 133 lines! ###
. This database currently allows for a maximum of 132 lines.
. Use "modifydb" to increase the maximum number of transit lines.
Database must be .
dimensioned for more transit . Would you like to generate the "split2layovers.in" file anyway (y/n)?n
lines

Enter: Next module=device

Current terminal type is: Emtool


Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

. ### WARNING: The new set of transit lines contains 4338 segments! ###
. This database currently allows for a maximum of 4337 segments.
. Use "modifydb" to increase the maximum number of transit segments.
Database must be .
dimensioned for more transit . Would you like to generate the "split2layovers.in" file anyway (y/n)?n
segments

• At the end of the line-splitting procedure, if the user decides to update the current and/or another
scenario with the new set of transit lines, the specified scenario must not be protected. If it is the
following error message will be displayed, and the user must specify another scenario number.

Enter: Next module=device

. Replace the transit lines in another scenario?y


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

. Scen. 1500(--- A-):>Winnipeg Network w/ Old Transit Lines


. Scen. 1000(DME AA): Winnipeg Road and Transit Network - Base Scenario
. Scen. 1001(--- AA): Unprotected Copy of Scenario 1000
. Scen. 1500(--- A-):>Winnipeg Network w/ Old Transit Lines
. Scen. 2000(DME AA): Kildonan Corridor - Stage One
. Scenario to be updated=1000
. Scenario 1000 is protected against modifications!
.
. Replace the transit lines in another scenario?y
. Scen. 1500(--- A-):>Winnipeg Network w/ Old Transit Lines
. Scen. 1000(DME AA): Winnipeg Road and Transit Network - Base Scenario
. Scen. 1001(--- AA): Unprotected Copy of Scenario 1000
. Scen. 1500(--- A-):>Winnipeg Network w/ Old Transit Lines
. Scen. 2000(DME AA): Kildonan Corridor - Stage One
. Scenario to be updated=1001

Example 2.2.1 Split transit lines with layovers and update current scenario
In the following example, suffixes + and = are used to identify new transit lines. At the end of the
line-splitting procedure, the replace2layovers macro replaces the transit lines in the current
scenario (1500).

Enter: Next module=device

Current terminal type is: Emtool


Change? n

Current printer type is: ASCII printer 60 lines

Enter: Next module=~<split2layovers


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

2007/02/23 5-37
Supported Macros Emme Prompt Manual

Enter: Next module=device

........................................................................
Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

.
. The SPLIT2LAYOVERS macro splits transit lines having two layovers
Example 2.2.1 (continued) . into two distinct transit lines. At the end of the line-splitting
. procedure, the new set of transit lines is stored in
. "split2layovers.in". The macro REPLACE2LAYOVERS is then called to read
. in the new set of transit lines in the current scenario and/or
. in other scenarios.
.
. The name and the description of the new lines are obtained by adding
. the specified suffixes. Any character may be used, however it is
. recommended to avoid the following characters: ^ & * | " < >
.
. Notes:
. (1) Transit lines with no intermediary layover will be preserved.
. (2) This macro does not handle extra attributes.
.
. Suffix for the first transit line (up to first layover)
. Enter one character (Default: "")=+
.
. Suffix for the second transit line (after first layover)
. Enter one character (Default: #)==
.
. Using new line suffixes: + and =
.
. Exporting transit line definitions to file split2layovers.tmp
. Parsing the transit lines...
...splitting transit line 1
...splitting transit line 2
...splitting transit line 3
...splitting transit line 4
...splitting transit line 5
...splitting transit line 6
...splitting transit line 7
...splitting transit line 8
...splitting transit line 9
...splitting transit line 10
...splitting transit line 11
...splitting transit line 12
...splitting transit line 13
...splitting transit line 14
...preserving transit line 15e
...
...splitting transit line 65
...splitting transit line 66
...splitting transit line 67
...Transit line parsing done
split2layovers has completed.
.
. The new set of transit lines is found in the "split2layovers.in" file.
.
. The macro REPLACE2LAYOVERS replaces the existing transit lines in the current
. scenario and/or in other scenarios with the new set of transit lines.
.
. ### ALL EXISTING TRANSIT LINES IN THE MODIFIED SCENARIO(S) WILL BE DELETED!!!
.
. Replace the transit lines in the current scenario (1500)?y
... Transit lines replaced in scenario 1500.
.
. Replace the transit lines in another scenario?n

5-38 2007/02/23
Emme Prompt Manual Emme2notify: send an e-mail when process is finished

Example 2.2.2 Non-unique transit line names after splitting procedure


In the following example, some of the transit lines in the existing set of transit lines have names
that contain six-characters. This means that after the line-splitting procedure, the split lines will
have non-unique transit line names. The user has decided to split the lines anyways, and will edit
the file split2layovers.in and then call the macro replace2layovers from the Prompt
Console.

Enter: Next module=device

. Would you like to generate the "split2layovers.in" file anyway (y/n)?y


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

.
. Parsing the transit lines...
...splitting transit line 1
...splitting transit line 12
...splitting transit line 123
...splitting transit line 1234
...splitting transit line 12345
...splitting transit line 123456
...preserving transit line 1way
...splitting transit line A
...splitting transit line AB
...splitting transit line ABC
...splitting transit line ABCD
...splitting transit line ABCDE
...splitting transit line ABCDEF
...preserving transit line oneway
...Transit line parsing done
Warning: The following lines have ids that may not be unique in Emme since they
are longer than 6 characters:
... [’123456#’, ’ABCDEF#’]
split2layovers has completed.
.
. The new set of transit lines is found in the "split2layovers.in" file.
Enter: Next module=

5.2.3 Emme2notify: send an e-mail when process is finished

The emme2notify macro, located in the macros subdirectory, can be used to send the user an
e-mail notifying himself when a process, such as an assignment has completed.

The emme2notify macro is called like any other macro (see Saving and recalling macros on
page 3-20) with the following parameters:

Enter: Next module=device

to_addr to_addr subject msg


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines

~<emme2notify [--version|-h] -f -t -s -m
Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

-o smtp_outgoing_server [-a file]

The emme2notify macro passes the parameters to the EMME2NOTIFY utility (see Section 7.4).
For a description of the parameters, see Table 7.5.

Note: When the subject and the message contain at least one space, they must be enclosed in
quotes: under Windows systems double quotes (") must be used; under Linux systems, single (')
or double (").

2007/02/23 5-39
Supported Macros Emme Prompt Manual

5.2.4 Emme2shp: create shape file from Emme network

The emme2shp macro, located in the macros subdirectory, can be used to convert an Emme net-
work into a shape file and associated DBF files for the standard and extra network attributes.

The emme2shp macro is called like any other macro (see Saving and recalling macros on
page 3-20) with an optional parameter output_folder.

Enter: Next module=device

~<emme2shp [output_folder]
Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

• If no output folder is specified, the output files will be put in the emme2shp-scenario_number
folder where scenario_number is the ID of the current scenario.

• The emme2shp macro creates the following output files

• emmenodes.[shp,shx,dbf] for the nodes

• emmelinks.[shp,shx,dbf] for the links

• emmetlines.[shp,shx,dbf] for transit lines

• emmetsegs.dbf for transit segments

If there are any existing files in the specified output folder, the files are overwritten.

• There is a limit on the number of extra attributes that can be exported to DBF files: a maximum of
57 extra attributes per element type can be exported to corresponding DBF files.

• The emme2shp macro uses temporary files net.out, transit.out, extraI.out and
extraL.out to hold the Emme network attributes. These files are stored in the Database direc-
tory of the current project. Any existing files with the same name will be overwritten at the end

5-40 2007/02/23
Emme Prompt Manual Emme2shp: create shape file from Emme network

Example 2.4.1 In the following example, the emme2shp macro is used to create a shape file of the network in the
base scenario, scenario 1000, of the demonstration database. The output is sent to the
winnipeg folder.

Enter: Next module=device

Enter: Next module=s=1000


Current terminal type is: Emtool
Change? n

Current printer type is: ASCII printer 60 lines


Change? y
Select: Type of printer
1= ASCII printer 60 lines
2= ASCII printer 80 lines
3= HP Laserjet
3
Current plotfile type is: GPL/GPR plotfile
Change? n

Scen. 1000(DME AA): Winnipeg Road and Transit Network - Base Scenario
Enter: Next module=~<emme2shp winnipeg
Exporting node and link standard attributes in file net.out
Exporting extra attributes to file extraI.out
Enter: Next module=
Exporting extra attributes to file extraL.out
Enter: Next module=A subdirectory or file winnipeg already exists.
Parsing ’t nodes’ section...
Parsing ’t links’ section...
Preparing .dbf files...
Writing emme nodes...[0%.....|50%|....100%]
Writing emme links...[0%.....|50%|....100%]
...Base network parsing done
Created 1057 nodes and 2975 links.
Node shapefiles generated at winnipeg
Link shapefiles generated at winnipeg
Writing emme transit lines... 1a . 1b . 2a . 2b . 3a . 3b . 4a . 4b
. 5a . 5b . 6a . 6b . 7a . 7b . 8a . 8b . 9a . 9b .10a .10b
.11a .11b .12a .12b .13a .13b .14a .14b .15ae .16a .16b .17a
.17b .18a .18b .19a .19b .20a .20b .21a .21b .22a .22b .23a
.23b .24a .24b .25a .25b .26a .26b .27ae .27be .
28a .28b .29a .29b .30a .30b .31a .31b .32a .32b .33a .33b
.34a .34b .35ae .35be .36a .36b .37a .37b .38ae .38be .39a .39b
.40a .40b .41a .41b .42a .42b .43a .43b .44a .44b .45ae .45be
.46a .46b .47a .47b .48ae .48be .49ae .49be .50ae .50be .51ae .51be
.52a .52b .53a .53b .54a .54b .55a .55b .56ae .5
6be .57a .57b .58a .58b .59ae .59be .60a .60b .61a .61b .62a
.62b .63a .63b .64a .64b .65a .65b .66a .66b .67a .67b .
...Transit line parsing done
Transit shapefiles generated at winnipeg
emme2shp has completed.

2007/02/23 5-41

You might also like