Open topic with navigation

TIBCO GridServer® 7.1.0

# The If Statement

The syntax of the if statement is

    if expression comparisonOperator expression then
        statements
    end

PDS also supports `elsif` and `else` clauses. You can use the `if` statement inside a lifecycle 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.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO GridServer®

Copyright © 2001-2022. TIBCO Software Inc. All Rights Reserved.