concatenate selected cols into one not hardcoding cols

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

concatenate selected cols into one not hardcoding cols

Post by kaps »

I want to concat some of the cols from a record into one single column. I was hoping to do this with row merger but it seems it will concat all the columns. I could not figure out a way to concat some of the cols.

Basically I am trying to concat all the cols except key cols to find the CRC value for CDC.

I don't want to use : operator as I don't want to hard code col names.

Any Ideas....

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Use the : operator.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

From memory if you define the key columns on the input and output links of the row merger stage it wont concatenate them. It treats them as pass through columns and concatenates those columns that are not on the output tab.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Don't believe that's the case. I seem to recall it always concatenating all columns together. :?

Checked the docs and they don't mention anything special about the key fields, but it would be simple enough to test and see.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Spool the data to a Sequential text file with a "," (comma) as the field separator, having the unique row identifier as the first column, an additional new column called "FAKE_SEPARATOR" with a derivation of literal "|" (pipe), and then the rest of the attribute columns after that. Read back the same Sequential text file, this time use field separator in the Format tab of "|" (pipe). You need 2 columns of metadata: "KEY" and "DATA". All of your attributes are magically packed with comma separators, which is important in using the CRC32 function. 123 concatenated with 456 is 12346, but so is 12 and 3456.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Thanks for all the inputs. I have tested vmcburney's idea but it does not help. Row Merger concatanates all the cols irrespective of key cols or output tab cols.

I will try Kenneth's Idea...

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

Post by ArndW »

I've used what Ken described many times in jobs to do this; plus this interim file should be declared as a pipe to avoid I/O and speed up processing.
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

Thanks Arnd and Ken !

I tried Ken's idea and it worked. Then I was trying to use Arnd idea of pipe for performance but ran into problems. It simply hangs if I don't use timeout's and fails if I use timeouts.

Read the forum again and as per some one's suggestion I broke the job into two streams and it worked. I am curious to know the reason for this behaviour ? Anyone care to explain....

Thanks
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

kaps wrote:Read the forum again and as per some one's suggestion I broke the job into two streams and it worked. I am curious to know the reason for this behaviour ? Anyone care to explain....
It's just one of those things.

The pipe solution is great for added performance, but if your performance is acceptable without using it then consider the easier maintenance without using a pipe.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply