ELSE IF STATMENT

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

ELSE IF STATMENT

Post 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
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
it is red since you need to add another else clause!

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

Post by bobby »

HI Roy,
Boss can u write code plz .
Thanks
Bobby
bibhudc
Charter Member
Charter Member
Posts: 20
Joined: Thu Jun 19, 2003 12:26 pm

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Hi

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

Thanks
Siva
bobby
Participant
Posts: 86
Joined: Mon Jul 19, 2004 8:31 pm

Post 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
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply