Getting filename in every record

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
reddy.vinod
Participant
Posts: 36
Joined: Mon Jul 16, 2007 3:37 am
Location: USA

Getting filename in every record

Post 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
VINOD
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
reddy.vinod
Participant
Posts: 36
Joined: Mon Jul 16, 2007 3:37 am
Location: USA

Post 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..
VINOD
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply