Build Stage Job

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
dalecooper
Participant
Posts: 20
Joined: Tue May 13, 2008 1:24 am
Location: Dale Cooper

Build Stage Job

Post by dalecooper »

Hi

Does anybody know what the syntax is to convert an integer to a string in the "Build Stage". Function atoi(String to Integer) works but looks like function itoa(Integer to String) is not working.

Example : IntRec = atoi(StringRec) works.

I know it is possible to use other stages to do this, but I want to get it to work in a "Build Stage".

Thanks
Dale
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

what is not working? Are you assigning the string value as the return value?
BIuser
Premium Member
Premium Member
Posts: 238
Joined: Thu Feb 02, 2006 4:03 am
Location: South Africa

Post by BIuser »

Hi

I'm trying to convert an integer value to a string or char value.

ex var = 1 (integer) and I want to convert it to a string or char "1", the reason for this is because I then want to reformat it to "01".(Add the 0)

Thanks!
-------------------------
https://www.ssa.co.za
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This is a different question. Please start a new thread.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dalecooper
Participant
Posts: 20
Joined: Tue May 13, 2008 1:24 am
Location: Dale Cooper

Post by dalecooper »

ArndW
what is not working?

In the Build Stage it is possible to use the C function atoi to convert string to integer, but the
opposite function itoa does not work.


Are you assigning the string value as the return value?
Syntax : char * itoa ( int value, char * str, int base );

Tried ReturnValue = itoa(CharValue,buffer,10) where ReturnValue is char. buffer also char.

Try to achieve something like this:
InputValue(char) = "123"
Split the string into 1,2 and 3, convert to integer using atoi and add together to equal 6 (1+2+3)

Now I want to convert the 6(Integer) to a string to append "A" to the 6 to give the result "A6"

I have no idea how to do this using a "Build Stage"?
Should I rather use an External Function Routine?

Thanks
Post Reply