Creating a file 'Dynamically'

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
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Creating a file 'Dynamically'

Post by yaminids »

Hello friends,

Is there any way to create a file dynamically. I have about 60 records (containing names of customers) in the input file and my intension is to create a separate file for each customer.

Thanks very much in advance
-Yamini
dhiraj
Participant
Posts: 68
Joined: Sat Dec 06, 2003 7:03 am

Post by dhiraj »

You could but all the files you create would be enclosed in a folder.

Use the folder stage as your target. Folder stage takes 2 columns as inputs. first is the file name and the second should be the entire record concatenated (or data that you wish to write to the file).

Regards
Dhiraj
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Try a unix level command as given below

for i in `sort -u testfile.txt`
do
grep "$i" testfile.txt > $i.out
done

where testfile.txt is the name of your file. You may have to change the sort and grep commands to indicate the position, case sensitivity etc.
Post Reply