Page 1 of 1

switch stage

Posted: Sun May 08, 2011 10:45 pm
by vasubabu
Hi,

I am using the switch stage in my job.when i give values in case statemnets as character it is aborting and giving the error as "A value was not specified as a case option"

example:-
selector ENAME
case 'SMITH'
case 'MILLER'.

If i select the selector as EMPNO and numbers in case statment,it is working fine.
Does switch not supports the characters in case statment?

Please reply me why i am getting this error?

Posted: Mon May 09, 2011 12:02 am
by ray.wurlod
That error suggests that there's a value in your data for which you have not coded. Try adding an "otherwise" case. Are you directing particular values to particular output channels?

Posted: Mon May 09, 2011 1:45 am
by vasubabu
ray.wurlod wrote:That error suggests that there's a value in your data for which you have not coded. Try adding an "otherwise" case. Are you directing particular values to particular output channels? ...
Hi Ray,

I am routing output to the proper output link as well.
ex:-
case = 'SMITH' =0
case ='JONES' =1
case = default =2

Still i am getting the same error as A value was not specified as a case option.

Please adivice me to rectify this error.

Posted: Mon May 09, 2011 7:00 am
by ppgoml
I have no idea on your issue with switch stage, but I think you could use a filter stage or transform stage instead. why not have a try.

Posted: Mon May 09, 2011 7:45 am
by greggknight
my code is
case=N=0
no quote
no problem


options
If not found = output
and I have a file on the reject link.

Posted: Mon May 09, 2011 7:50 am
by MarkB
You can certainly use 'characters' in the Case statement of the switch.

For example, try:

CASE = SMITH=0
CASE = JONES=1

Under Options, pick either Drop to drop rows not in the CASE, OUTPUT for sendingdown a reject link, or FAIL to abort.

Posted: Mon May 09, 2011 7:53 am
by greggknight
Also I would stay with the switch in stead of the transformer. The transformer is the easy way out but the most costly in terms of performance.

Also you might try the option if not found set it to output and attach a reject file

Posted: Mon May 09, 2011 2:50 pm
by ray.wurlod
greggknight wrote:The transformer is the easy way out but the most costly in terms of performance.
I don't believe that's true any more. But I have no empirical results either way.

Posted: Mon May 09, 2011 3:06 pm
by BradMiller
The transformer is the easy way out but the most costly in terms of performance.
According to IBM's training materials for Advanced DataStage Training (DX445), page 322: "Transformer constraints are FASTER than the Filter or Switch stages. Filter and Switch expressions are interpreted at runtime, Transformer constraints are compiled."