IBM Integration Bus, Version 9.0.0.8 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

IF statement

The IF statement executes one set of statements based on the result of evaluating condition expressions.

Syntax

Read syntax diagramSkip visual syntax diagram
       .-ELSEIF-----------------------.                         
       V                              |                         
>>-IF----expression--THEN--statements-+--+------------------+--->
                                         '-ELSE -statements-'   

>--END IF------------------------------------------------------><

Each expression is evaluated in turn until one results in TRUE; the corresponding set of statements is then executed. If none of the expressions returns TRUE, and the optional ELSE clause is present, the ELSE clause's statements are executed.

UNKNOWN and FALSE are treated the same: the next condition expression is evaluated. ELSEIF is one word with no space between the ELSE and the IF. However, you can nest an IF statement within an ELSE clause: if you do, you can terminate both statements with END IF.

Example

IF i = 0 THEN
   SET size = 'small';
ELSEIF i = 1 THEN
   SET size = 'medium';
ELSEIF j = 4 THEN
   SET size = 'large';
ELSE
   SET size = 'unknown';
END IF;


IF J> MAX THEN
  SET J = MAX;
  SET Limit = TRUE;
END IF;

ak05040_.htm | Last updated Friday, 21 July 2017