Null Value in Stage variable and related fatal error

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Null Value in Stage variable and related fatal error

Post by RAJARP »

Hi all.


Intially i had one expression for a stage variable

Code: Select all

 if  TrimIndicator ='A' and ValidZip='ZIPVALID' and ValidMail='MAILVALID' and ValidSmail='SMAILVALID'
     
     then
     'VALID'
     else
'REJECT'

I got one fatal error 'Null value on the accessor interfacing to field "INDICATOR".'

Note :where TrimIndicator is a stage variable with expression 'Trim(NullToEmpty(transformer_link.INDICATOR))'

and it has null values too.




so i modified the expression as follows

Code: Select all

 if TrimIndicator='' then
 'REJECT'
 
 else
 
 (if ValidZip='ZIPVALID' and ValidMail='MAILVALID' and ValidSmail='SMAILVALID' 
 
 then 
 'VALID'
 else
'REJECT')
and i did not got any error.

so i want to know what went wrong in the first case. Your help would be highly appreciated

Regards,
Raja R P
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

The only way to get that error message is to do a test or a function (other than the "Null" type functions) on a field that contains a null value.

For instance in your original code where you say " if TrimIndicator ='A'", if you had not put the NulltoEmpty conversion in place prior to that test - you'd have the problem.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Post by RAJARP »

hi asorell,
Thanks for your time.In my code, before using " if TrimIndicator ='A' " i had put the NulltoEmpty conversion .Even then i got that fatal error.

Thanks,
Raja R P
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

Post by Sreedhar »

Before I can answer you question I would like to know the source of your data.
Regards,
Shree
785-816-0728
mkkgupta
Premium Member
Premium Member
Posts: 17
Joined: Thu Jan 24, 2008 10:13 pm

Post by mkkgupta »

modify your Stg Var. by using if then else.

if Isnull(Input) then some value else trim(input)
then reject based on value given in Stg var.
Regards
Kiran
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Post by RAJARP »

sreedhar,
my data source is an oracle table.

Thanks,
Raja R P
Post Reply