Page 1 of 1

Getting filename in every record

Posted: Wed Jul 25, 2007 5:30 am
by reddy.vinod
Hi ,
i have one file is
file1.txt
1,2,3
2,3,4

I wanna add the file name in every record like
file1.txt,1,2,3
file1.txt,2,3,4
i have to use dos commands in before job routine.while reading this file i need to get with file name

thkssssssssssssss

Posted: Wed Jul 25, 2007 6:36 am
by Maveric
How are u passing the name of the file? Parameter or hard coded? If it is hard coded then u can use a transformer to create the field and hard code this value in the derivation. Not sure if u have a column generator in the server jobs. if u have it then u can do it over there as well. Same if it is a parameter. You can give it in the field derivation in transformer.

Posted: Wed Jul 25, 2007 7:22 am
by chulett
As noted, how are you getting the filename in the first place? Typically, that would be a job parameter and if so, just use it for the derivation of this new field.

Posted: Wed Jul 25, 2007 7:22 am
by reddy.vinod
Maveric wrote:How are u passing the name of the file? Parameter or hard coded? If it is hard coded then u can use a transformer to create the field and hard code this value in the derivation. Not sure if u have a column generator in the server jobs. if u have it then u can do it over there as well. Same if it is a parameter. You can give it in the field derivation in transformer.
Hi,
I have one folder that contain multiple files,i need to read all the file using one stage(may be seq or folder anything),storing the records into database and records contain the name of the file.so i have to write one routine ,using that i have to give filename in evrey record..this same thing is to be done for other files in the folder..

Posted: Wed Jul 25, 2007 12:52 pm
by ray.wurlod
If you have Enterprise Edition the parallel job Sequential File stage has the capability you ask for (a file name column).

Otherwise you will need to construct a loop in a job sequence to process the list of file names, and pass each individual file name to the job, which can then create a file name column in a Transformer stage.

Your "all in one stage" requirement is impossible to achieve in a server job.

I reject your requirement and substitute my own. (Apologies to Adam Savage)