HP StorageWorks Storage Mirroring for Linux User's Guide (T2558-96078, February 2008)

A - 39
DTCL Scripting
To simplify using Storage Mirroring and DTCL, you can create script files to execute series and combinations of commands
to meet specific needs.
Variables
Variables can be used in commands to replace items that vary such as machine or domain names. A variable name must start
with the
$ character and can contain letters, numbers, strings, and integers. Values are assigned to variables using the '='
assignment statement. For example, valid variable assignment statements are:
$MyDomain="domain.com";
$MySource=indy;
All DTCL commands return values which can also be assigned to variables. For example, the connection command returns
a connection ID for the new connection. The statement:
$ConnectionID=CONNECT dataset to target;
saves the connection ID as a variable. The variable components of the connect command could be replaced as well. For
example:
$TheRepset=“Customer Data”;
$TheTarget=jersey;
$ConnectionID=CONNECT $TheRepset to $TheTarget;
Flow control
DTCL scripts can take advantage of four programming constructs.
IF conditional—The IF conditional expression is a comparison between two values or variables. Use the following syntax
for an IF conditional:
IF <relational expression> THEN <statement_block>
[ ELSE <statement_block> ] END
Use the following conditions to create the relational expression:
= Is equal to
!= Is not equal to
< Is less than
<= Is less than or equal to
> Is greater than
>= Is greater than or equal to
statement block Any sequence of valid DTCL commands
FOR Loop—The FOR loop sets a variable to a start value, executes each statement in the statement block, and then adds
the step value to the variable. If the new value of the variable does not exceed the end value then the statements will be
executed again. This continues until the variable exceeds the end value. If a step value is not provided, the default adds
one to the variable. Use the following syntax for the FOR loop:
FOR <variable> = <start_value> TO <end_value>
[STEP <step_value>] DO <statement_block> END
NOTE: When creating DTCL scripts, each commented line must start and end with the pound (or number) sign (#).
Each DTCL command and assignment must end with a semi-colon. However, no semicolon is necessary after
the END keyword for the IF conditional and the loop statements.
When using the Command Line Client, a script file can be executed using the
-f option.