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

$IfDef and $IfNDef Statements

Tests an identifier to see if it is defined or not defined. Not available in expressions.

Syntax

{$IfDef | IfNDef} identifier   [ statements ]
$Else   [ statements ]
$EndIf

identifier is the identifier to test for.

$Else specifies alternative statements to execute.

$EndIf ends the conditional compilation block.

Remarks

With $IfDef, if identifier is defined by a prior $Define statement, all the program source lines appearing between the $IfDef statement and the closing $EndIf statement are compiled. With $IfNDef, the lines are compiled if the identifier is not defined. $IfDef and $IfNDef statements can be nested up to 10 deep.

Example

This example shows how $Define can be used at compile time to determine whether a routine operates in a debugging mode, and how $IfDef and $IfNDef are used to control program flow accordingly:

* Set next line to $UnDefine to switch off debugging code
$Define DebugMode
...
$IfDef DebugMode
* In debugging mode, log each time through this routine.
Call DSLogInfo("Transform entered,arg1 = ":Arg1, "Test")
$EndIf

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

Update timestamp Last updated: 2010-09-30