Page 1 of 1

ELSE IF STATMENT

Posted: Sat Aug 07, 2004 11:14 am
by bobby
HI,
MY SOURCE IS
CHANNEL_TYPE
DS
D2D

Trarget wanna be
B
C

IF DSLink59.CHANNEL_TYPE= DS THEN "B" ELSE IF DSLink59.CHANNEL_TYPE=D2D THEN "C"


THE ERROR IS RED IS THIS NOT RITE
THNXS
BOBBY

Posted: Sat Aug 07, 2004 11:36 am
by roy
Hi,
it is red since you need to add another else clause!

IHTH,

Posted: Sat Aug 07, 2004 11:39 am
by roy
ok to short a post!
in your derivation you wrote an If Then Else statement it has no else if so you actually started a new If Then Else statement in the Else clause, since you left out the Else cluase of the new If Then Else statement it is red.

IHTH,

Posted: Sat Aug 07, 2004 11:54 am
by bobby
HI Roy,
Boss can u write code plz .
Thanks
Bobby

Posted: Sat Aug 07, 2004 4:39 pm
by bibhudc
Bobby,

Roy wanted you to try this

IF DSLink59.CHANNEL_TYPE= DS THEN "B" ELSE IF DSLink59.CHANNEL_TYPE=D2D THEN "C" ELSE "X"

-Bibhu

Posted: Sun Aug 08, 2004 3:12 am
by ray.wurlod
Plan your If .. Then .. Else .. constructs, and use the Expression Editor to build them. In this way you will not be left with a dangling clause in the expression.

And, Bobby, can you please write in English? These SMS-style expressions are difficult for those participants whose first language is not English.

Posted: Sun Aug 08, 2004 6:20 am
by rasi
Hi

Do some fundamental programming course which you give the ideas of framing these logic inside this tool

Thanks
Siva

Posted: Sun Aug 08, 2004 8:07 am
by bobby
hi
i use this same clause
still red

IF DSLink59.CHANNEL_TYPE= DS THEN "B" ELSE IF DSLink59.CHANNEL_TYPE=D2D THEN "C" ELSE "X"

JUST WANT TO HARD CODE B AND C FOR DS AND D2D FROM SOURCE

Plz advice
Thanks
Bobby

Posted: Sun Aug 08, 2004 9:30 am
by roy
Hi,
your DS and D2D are they constants?, meaning the actual values in the column your checking?
if so you must treat them as strings, since they are strings, hence you need to enclose them in qoutes or double qoutes so put them as "DS" and "D2D"

Good Luck,

Posted: Sun Aug 08, 2004 9:31 am
by roy
Hi,
Sorry for asking, but what DS training did you go thru?
If you have none you need it ASAP, IMHO only.

Good Luck,

Posted: Sun Aug 08, 2004 9:34 pm
by ray.wurlod
If you would use the Expression Editor to create this expression you would discover that input column names must be qualified with input link names. String constants must be quoted, as in most (all?) programming languages.

Hence for example, unless it's the name of a stage variable, D2D is meaningless to the expression parser. If they're quoted, they're character string constants; if they're qualified with an input link name, they're input columns; if they're surrounded by a pair of "#" characters they're references to job parameters.

Use the Expression Editor for all expression building. Every time you touch the keyboard you're prone to making errors. By always using the Expression Editor you also become more and more proficient in its use, and exult in the graphical interface that DataStage provides as a rapid development environment.

Work through the Tutorial supplied with DataStage.

Enrol on the DataStage classes. They're available via the Web, though I'd always advocate getting on an instructor-led class if possible.