Information icon IBM InfoSphere DataStage and InfoSphere QualityStage, Version 8.5
space Feedback

If...Then Statements

Execute one or more statements conditionally. You can use a single-line syntax or multiple lines in a block. Not available in expressions.

Syntax

If condition Then statement
If conditionThen 
   statementsEnd

condition is a numeric value or comparison whose value determines the program flow. If condition is true, the statements are executed.

statements are the statements to be executed when condition is true.

Remarks

If you want to execute more than one statement when condition is true, use the multiline syntax.

Example

This example illustrates various forms of If...Then construction that can be used in a routine:

Function MyTransform(Arg1, Arg2, Arg3)
* Then clause occupying a single line only:
   Reply = 0               ;* default
   If Arg1 Matches "A..." 
      Then Reply = 1
* Multi-line Then clause: 
   If Len(arg1) > 10 Then
      Reply += 1
      Reply = Arg2 * Reply
   End

* Another style of multiline Then clause:
   If Len(Arg1) > 20 
   Then
      Reply += 2
      Reply = Arg3 * Reply
   End 
Return(Reply)

PDFThis topic is also in the IBM InfoSphere DataStage Server Job Developer's Guide.

Update timestamp Last updated: 2010-09-30