Merge 240 flat-files into one and then process using DataSta

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
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Merge 240 flat-files into one and then process using DataSta

Post by I_Server_Whale »

Hi Gurus,
I have 240 flat-files, each having the same number of fields (15). The files are located on a Windows Box (on a network). The DataStage 7.5.1 server and clients are on a windows box as well.

How do I merge these 240 files? I need to transform after merging these files. If I use a Merge Stage (Do we have merge stage in 7.5.1 Server job or is it called row-merger?), does it create any performance issues? If so, is there any other way of tackling this?. Any suggestion or advice is tremendously appreciated.

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

Post by chulett »

Use a script/bat before job to concatenate them all together, then process the concatenated file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I agree with Craig - even though DS can process files and file lists, all you need to do is a "type c:\mydir\*.txt >> outfile.txt" in dos and skip the lines that contain empty or just the filename. Or get the free unix commands for dos and use the cat command.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Thank you Craig and ArndW. Say if I have three flat-files, ff1.txt, ff2.txt and ff3.txt in the "Merge" folder of the C drive.

Will the command look something like this?

Code: Select all

 C:\Merge\*.txt >> output.txt 
Where should I execute this command in windows?

Thanks again,
Naveen.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Merge cannot be run from DOS / Windows command prompt.

You may need to either write a routine or call from OS level API.

You need to code so that the job merges 2 files at a time and does for all the 240 files.
ds_user78
Participant
Posts: 23
Joined: Thu Nov 11, 2004 5:39 pm

Post by ds_user78 »

I believe you can do something like type c:\merge\*.txt > c:\merge\outfile.txt This you have to execute at the command prompt.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try not to have the target file in the same folder as the source files.

Code: Select all

type c:\merge\*.txt > c:\temp\outfile.txt 
Or simply speccify type c:\merge\*.txt as the filter in a Sequential File stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Doh!! So you were referring to 'concatenate' the files and not DataStage 'merge'. I got confused.

As Ray suggested, you can either use any DOS / Win command for concatenating and then use it in the job or use the command directly in the filter stage.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Thanks a lot!
Ray, ds_user78, ArndW, chulett and Sainath.

Naveen.
shawn_ramsey
Participant
Posts: 145
Joined: Fri May 02, 2003 9:59 am
Location: Seattle, Washington. USA

Post by shawn_ramsey »

naveendronavalli wrote:Thanks a lot!
Ray, ds_user78, ArndW, chulett and Sainath.

Naveen.
I am not to sure if you found the actual command that you want. The correct syntax is:

Code: Select all

copy c:\merge\*.txt /a c:\temp\combofile.txt /a
Shawn Ramsey

"It is a mistake to think you can solve any major problems just with potatoes."
-- Douglas Adams
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

hello Shawn,
Yes! You are right. That is the correct syntax of the command. Thanks a lot,

Naveen.
Post Reply