Page 1 of 1

datastage

Posted: Fri Jul 22, 2011 3:52 am
by bharatmajeti
Hi all,
my source is db2 and target is flat file,loading the data using teansformer stage.here i need to convert the RGB value into hexadecimal value.please let me know,how can i convert using transformer stage.please tell me briefly.

Posted: Fri Jul 22, 2011 8:05 am
by jwiles
Transformer doesn't currently have an integer<-->hex conversion function builtin.

I don't know what your RGB value is, but if it's a column in the data you've extracted from DB2, use a Column Export stage to convert that column from Integer (assuming integer) to Char or VarChar and in the column metadata (input tab, double-click on the column number), select Integer type, then either C_format or Out_format and place an appropriate C-style format specifier. In this case, it will be %x or %X, or some variation of those.

[EDIT]: If all you need to do is to write the "RGB" value out as a hex vlaue in the flat file, use the same options in the sequential file stage as I described for the Column Export stage, then you don't need Column Export.[/EDIT]

The wikipedia article on printf has a list of the format specifiers for reference.

Regards,