How to wirte logical statement

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
kamalshil
Participant
Posts: 179
Joined: Mon Jun 23, 2008 1:19 am

How to wirte logical statement

Post by kamalshil »

Its just an simple question as i am trying to write this logic some time i am getting output some time not why its happing can you please let me know...
Can any 1 suggest me whats the correct way to write them.

Code: Select all

if columnname = 'a' or 'b' 
And this code do i have to put ('a' or'b')
OR

Code: Select all

if columnname='a' or columname='b'

And also do v have any of case statement in this
dhanashreepanse
Participant
Posts: 25
Joined: Fri Jan 11, 2008 12:49 am
Location: Pune, India

Post by dhanashreepanse »

Correct way to write is:
if columnname='a' or columname='b'

Please elaborate on what information you seek regarding Case statement.
kamalshil
Participant
Posts: 179
Joined: Mon Jun 23, 2008 1:19 am

Post by kamalshil »

dhanashreepanse wrote:Correct way to write is:
if columnname='a' or columname='b'

Please elaborate on what information you seek regarding Case statement.
case statement which be use for multiple if else type of statements.
And i also want to know is there any Decode statement we can also use?
dhanashreepanse
Participant
Posts: 25
Joined: Fri Jan 11, 2008 12:49 am
Location: Pune, India

Post by dhanashreepanse »

I believe you cannot write CASE statements in the derivations but they can be written within a function.
kamalshil
Participant
Posts: 179
Joined: Mon Jun 23, 2008 1:19 am

Post by kamalshil »

dhanashreepanse wrote:I believe you cannot write CASE statements in the derivations but they can be written within a function.
how can we do this can you please let me know?
dhanashreepanse
Participant
Posts: 25
Joined: Fri Jan 11, 2008 12:49 am
Location: Pune, India

Post by dhanashreepanse »

You can check it in DS Help.
Find for CASE
kamalshil
Participant
Posts: 179
Joined: Mon Jun 23, 2008 1:19 am

Post by kamalshil »

i got the solution and way to write the logical statment.

in correct way as :
Correct way to write is:
if columnname='a' or columname='b'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

While that is correct as far as it goes, the If expression is not complete until it has both a Then clause and an Else clause. This is because it is a value-producing expression; it must produce a value whether the test condition is true or false. If there is any possibility that any value in the test expression might be null, best practice is to test for this explicitly: however if you do not, then any null in the expression will cause the Else path of the expression to be taken, the reasoning being that you can not assert that null is "true", and the Else path is taken when the test expression is not true (not necessarily the same thing as "false").
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