The If Statement

The syntax of the basic if statement is

if expression comparisonOperator expression then
    statements
end

PDS also supports elsif and else clauses. The if statement can be used inside a block (prejob, pretask, task, posttask, postjob), to conditionally execute statements. One typical use is to execute different commands depending on the Engine’s operating system:

if $DSOS == "win32" then
    cmd = "dir"
else
    cmd = "ls"
end
execute "$cmd"

An if statement can also appear at the top level of a PDS script, to include or exclude global assignments or entire blocks. An example is

if $1 == "alwaysCancel" then
    options
        autoCancelMode "always"
    end
end

The if statement is not legal in the options, schedule, or discriminator blocks.