Page 1 of 1

String Constants in Px transform stages

Posted: Fri Mar 25, 2005 9:59 am
by ArndW
I would like to assign the value 0x3000 (Unicode/NLS) to a VARCHAR2 column as a constant expression in a Paralle transform stage. I can't for the life of me get this working; and haven't found reference in the docs on how to specify this string. I thought I had seen something here but didn't have any success using the search facility so perhaps someone can assist me.

Thanks...

Posted: Fri Mar 25, 2005 4:12 pm
by ray.wurlod
I think this is the post to which you were referring.

If you don't mind BASIC expressions, there's always

Code: Select all

UniChar(Iconv(3000, 'MX'))

Posted: Fri Mar 25, 2005 10:19 pm
by T42
I wonders what "MX" stands for. Mex? "A hex on your mex!"

Posted: Sat Mar 26, 2005 12:04 am
by ray.wurlod
Masked hexadecimal. There's also "MO" (octal) and "MB" (binary). They're all in the online help - drill down from Iconv or Oconv topics.

You can also use "MCXD" (masked character hex to decimal) and "MCDX" (masked character decimal to hex).

They never ask this kind of stuff at trivia nights! :twisted:

Posted: Sat Mar 26, 2005 7:10 am
by ArndW
Ray,

I'm staying in a Px transform so I can't use a Basic function; I have a fixed text to input so I am looking for a way in Px to specify a hex value for a string; i.e. like '0x3000' (except that doesn't work :roll: )

Posted: Sun Mar 27, 2005 12:10 pm
by T42
You got mail.

Also, here's the skinny of what I did:

[row generator] -> [transform] -> [peek]

In Row Generator, provide a single field of a VarChar(whatever), and provide the hex values on the "Edit Column Meta Data" (Columns tab, double click on #1).

In Transform, output the regular field (as Varchar(whatever), and another field with the following value: "0x" : [input field]. This field have to be an integer.

Peek stage, regular stuff.

Output:

Peek_2,0: output:254 dummy:0000FE
Peek_2,0: output:35 dummy:0023
Peek_2,0: output:100 dummy:0064

This works with DataStage 7.1r2.