about # value

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
ranga1970
Participant
Posts: 141
Joined: Thu Nov 04, 2004 3:29 pm
Location: Hyderabad

about # value

Post by ranga1970 »

Code: Select all

If Trim(inXfmDataScrub.GENDER) # '' Then @TRUE Else @FALSE
What does this mean? does it mean Trim(inXfmDataScrub.GENDER) Is null then @True else @False?
thanks
RRCHINTALA
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

# as an operator is one of four ways to express "is not equal to" in DataStage BASIC expressions. The others are:
  • <>
    ><
    NE
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Re: about # value

Post by kcbland »

ranga1970 wrote:

Code: Select all

If Trim(inXfmDataScrub.GENDER) # '' Then @TRUE Else @FALSE
What does this mean? does it mean Trim(inXfmDataScrub.GENDER) Is null then @True else @False?
thanks
Do NOT confuse blank with NULL. Absence of value is blank, NULL is an ASCII character value, dependent on your system setting (sometimes ASCII 0, othertimes 128).

You must know that a NULL condition cannot happen in your data for this expression to work. In the case of NULL, it would NEVER return TRUE, so would return UNKNOWN which would be @FALSE, because it cannot assert it is TRUE. A better thing to do is write a TRANSFORM or a FUNCTION such as EXISTS and use it to verify a variable has value:

Code: Select all

Function EXISTS(Arg1)
IF NOT(ISNULL(Arg1)) OR TRIM(Arg1) # "" Then Ans=@TRUE Else Ans=@FALSE
Return Ans
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

I think the "THEN @TRUE ELSE @FALSE" is redundant and you can write a derivation as

Code: Select all

Trim(inXfmDataScrub.GENDER) # ''
Which automatically equates to true or false.

Same with Ken's code:

Code: Select all

Ans = NOT(ISNULL(Arg1)) OR TRIM(Arg1) # "" 
Post Reply