Page 1 of 2

fmt FROM SERVER TO PARALLEL

Posted: Wed Dec 26, 2007 5:09 am
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

Posted: Wed Dec 26, 2007 5:30 am
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.

Posted: Wed Dec 26, 2007 5:50 am
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

Posted: Wed Dec 26, 2007 5:54 am
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.

Posted: Wed Dec 26, 2007 6:02 am
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 ....

Posted: Wed Dec 26, 2007 6:05 am
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.

Posted: Wed Dec 26, 2007 9:15 am
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

Posted: Wed Dec 26, 2007 9:18 am
by ArndW
What data types are your input and output columns?

Posted: Wed Dec 26, 2007 9:25 am
by chulett
Your output field needs to be a string and I'll wager it ain't.

Posted: Wed Dec 26, 2007 9:26 am
by suresh_dsx
My source data type is decimal
target data type is varchar

Posted: Wed Dec 26, 2007 9:28 am
by ArndW
Put in an explicit DecimalToString() function and see if it works.

Posted: Wed Dec 26, 2007 9:53 am
by suresh_dsx
i tried with that...

it is not returning any rows....

Please give me the solution with the syntax...

Thanks

Posted: Wed Dec 26, 2007 10:14 am
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.

Posted: Wed Dec 26, 2007 11:17 am
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...

Posted: Wed Dec 26, 2007 11:51 am
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?