fmt FROM SERVER TO PARALLEL

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

suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

fmt FROM SERVER TO PARALLEL

Post by suresh_dsx »

hI
I WANT TO USE THE SAME FUNCTION IN THE PARALLEL,,,
fmt(trim(LINK1.TEST),"9'0'R")
That is not possible PARALLRL JOBS beacuse of fmt function is not thier.
Can you please tell me how can we use the same login in the parallel jobs.

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

Post by ArndW »

As you've seen, the FMT function does not exist in Parallel jobs unless you choose to use a BASIC transform stage; but that is not recommended.

In your case you wish to format the number with leading zeroes to 9 places. You can do this simply by

Code: Select all

RIGHT('000000000':LINK1.TEST,9)
assuming your output is a VarChar data type and your input is a string or a valid datatype that can implicitly be converted to a string.
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

Post by suresh_dsx »

I want to use in the tranformer with the same logic.
How can i use that option in the parallel. i am trying with pad string and trim... still i am unable to find the solution....

Please give some solutions ... If any one know the idea please share with me.

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

Post by ArndW »

Suresh, the FMT function does not exist in parallel jobs; so you cannot just use the same logic. The function I suggested does the same thing as the FMT() but if you don't wish to use it then that is up to you.

What you are trying to do is somewhat like converting a PASCAL program to C++ and having a requirement that "the code is not be to changed". Server and Parallel are different products and cannot be converted without changing the code.
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

Post by suresh_dsx »

ok fine...

my source data is
Source
1
2
3
4
5

.
.
.
100
101
...so on

i want to make the output for that column like this

Output

000000001
000000002
000000003
.
.
.
.
000000100
000000101


........and so on...

Please give the solution. How can i convert in parallel.

Sorry for keep on asking same thing...i am new to the parallel.
i dont know two many functions in the parallel and also how to use them ....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I give up. I posted the solution in my first reply. Perhaps someone else can post another one which will satisfy Suresh.

(Addendum)
I think that I now understand, my original post is "Premium Content" and that part of the reply might not be visible to Suresh. The solution I proposed involves looking at the column as a string and doing your own formatting on that.
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

Post by suresh_dsx »

Hi,

i am trying with the below function

STR('0',9 - Len(DSLink4.test1)) : DSLink4.test1

i am finding the length and minus with 9.

the difference will be repated that many times and placed the zeros and finally concatenated with actual value.

But i am not getting the zeros, only getting the same source as output..

sample
Input column value = 319
STR('0',9-3):319
ANS: 319

But I NEED TO GET THE BELOW OUTPUT
000000319
Please give me some solutions...

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

Post by ArndW »

What data types are your input and output columns?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your output field needs to be a string and I'll wager it ain't.
-craig

"You can never have too many knives" -- Logan Nine Fingers
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

Post by suresh_dsx »

My source data type is decimal
target data type is varchar
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Put in an explicit DecimalToString() function and see if it works.
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

Post by suresh_dsx »

i tried with that...

it is not returning any rows....

Please give me the solution with the syntax...

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

Post by ArndW »

Suresh - try a test job that outputs your DecimalToString along with the original decimal to a test file and experiment until you get it working. Nobody here can magically solve your problem until you are able to successfully convert your decimal to a string.

It is usually useless to post a "it didn't work" without explaining what you tried.
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

Post by suresh_dsx »

I tried in this way.

i crated a one stage variable which calculates the length of the coulmn.
i created one more stage variable which minus with 9.

The final integer value will be passed to STR function. value

First Stage variable name:sta1
data type: integer
Derivation: Len(link.col1)

Second stage variable name:sta2
Data type:integer
Derivation:9- sta1


in the tranformer stage

Str(0,sta2)

========
Source input(Decimal)= 123
Output(Varchar)=000000000

i tried with decimaltostring function, it is returning zero values...
i tried with STR function. the value is repeating but it is not taking the actual value.

How can i get the value repeated values ( 9 - len(col1))....Please let me know...
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

suresh_dsx wrote:i tried with decimaltostring function, it is returning zero values...
You are doing far too many things at the same time to debug your problem. Start with a simple test to check the DecimalToString() function. Once you have converted your DSLink4.test1 column from decimal to a string then your

Code: Select all

STR('0',9 - Len(DSLink4.test1)) : DSLink4.test1
will work as expected. Does your decimal column have decimal places?
Post Reply