square brackets as a text in DB2 environment

Hi all,

We’re moving from Oracle to DB2.
In the oracle environment, I had a mapping, where I had to output “[ICP]” if it is a nullvalue.
This is the Oracle code(Mapping):
nvl(Validation_Movetype_Pass.HYP_ICP , ‘[ICP None]’)

So, I expect, when there’s a nullvalue, that the outupt is the following text:
[ICP None]

But I can’t make it run properly in DB2 environment. When I leave it unchanged, I get an empty Line.
No matter howe I change the code, DS either does not accept it - ging an error, or I just get an empty field/line.

How do I tell my DB2 that I need those square brackets?


Bajiman :switzerland: (BOB member since 2011-05-19)

What is the error you get? Is that a NULL or a space is the new system?


ganeshxp :us: (BOB member since 2008-07-17)

You have an escape character there so that DS doesn’t try to evaluate the square bracket. I think you need an additional escape character so that DB2 also doesn’t try to evaluate the square bracket.

Try this:

nvl(Validation_Movetype_Pass.HYP_ICP , '\\\[ICP None\\\]') 

eganjp :us: (BOB member since 2007-09-12)

try assigning this value to a global variable in a script and use the global variable in mapping

do the following in a script in the begining of the job
$G_ICP_VAL = ‘[ICP None]’;

use the following in mapping
nvl(Validation_Movetype_Pass.HYP_ICP , $G_ICP_VAL)


manoj_d (BOB member since 2009-01-02)

Thanks for your input.
DS does accept this code, but nonetheless, I still get an in that field.


Bajiman :switzerland: (BOB member since 2011-05-19)

Hi Ganesh,

I do get an
:wah:


Bajiman :switzerland: (BOB member since 2011-05-19)

Thanks for your idea!

I gave it a try, but still…no success…I only get an

So I started combining these great ideas you all gave me here, unfortunately without success…
I’m trying more combinations…
:?


Bajiman :switzerland: (BOB member since 2011-05-19)

Try this one for me

IFTHENELSE(LTRIM_BLANKS(RTRIM_BLANKS(NVL(Validation_Movetype_Pass.HYP_ICP,’’))) = ‘’, ‘[ICP None]’, Validation_Movetype_Pass.HYP_ICP)


ganeshxp :us: (BOB member since 2008-07-17)

I think the problem is that no matter what has been tried we haven’t worked around DB2 doing something with the square brackets.

This works fine in a DS script:

print('This is \[nothing\]');

It prints:

So if DS doesn’t have a problem with it then the problem must be on the DB2 side. Focus your efforts there.

Moral to the story: Don’t use DB2. :mrsbob: [/quote]


eganjp :us: (BOB member since 2007-09-12)

Ganesh…guess what…it…works!
WONDERFUL! :+1:

Thank you very much :yesnod:

[/quote]

About the morals…I do absolutely agree with you…I always tell my boss that I want to return to Oracle… :nopity:


Bajiman :switzerland: (BOB member since 2011-05-19)

Hah I am very glad it worked.

Well we do have the way to treat SAP NULL’s as NULL however, it looks like we really don’t have a way to treat DB2 NULL’s as NULL maybe?


ganeshxp :us: (BOB member since 2008-07-17)