Capturing File name of the file being loaded

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
amit_dwh
Participant
Posts: 22
Joined: Tue Apr 11, 2006 6:04 am

Capturing File name of the file being loaded

Post by amit_dwh »

Hi

I have to capture the file name of the file which i am currently loading into a database and insert this file name along with the data in database.

How can this be done in datastage, i am reading fix width files.

Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Parametrize the filename and use that parameter to get the name of the file. Which ofcourse means you should know what the file name is prehand.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
s_boyapati
Premium Member
Premium Member
Posts: 70
Joined: Thu Aug 14, 2003 6:24 am
Contact:

Re: Capturing File name of the file being loaded

Post by s_boyapati »

You need to develop job with parameter to store file name ( assuming you know file anme before you read that). Use transformer stage to map the parmater name to field that mapped again to DB filedname. So each row will carry its file name along with data. That is the standard solution for this problem. one more assumption here is, when reading files in "sequential file" stage, you are setting "read method" as "specific files" rather than "File pattern".

Sree

amit_dwh wrote:Hi

I have to capture the file name of the file which i am currently loading into a database and insert this file name along with the data in database.

How can this be done in datastage, i am reading fix width files.

Thanks
anton
Premium Member
Premium Member
Posts: 20
Joined: Wed Jul 19, 2006 9:32 am

Re: Capturing File name of the file being loaded

Post by anton »

there is "almost" working more elegant solution here:
http://dsxchange.com/viewtopic.php?p=210536

however, it does not quite work :(
s_boyapati wrote:You need to develop job with parameter to store file name ( assuming you know file anme before you read that). Use transformer stage to map the parmater name to field that mapped again to DB filedname. So each row will carry its file name along with data. That is the standard solution for this problem. one more assumption here is, when reading files in "sequential file" stage, you are setting "read method" as "specific files" rather than "File pattern".

Sree

amit_dwh wrote:Hi

I have to capture the file name of the file which i am currently loading into a database and insert this file name along with the data in database.

How can this be done in datastage, i am reading fix width files.

Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You are replying to a post that was last answered in Jun 06.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
anton
Premium Member
Premium Member
Posts: 20
Joined: Wed Jul 19, 2006 9:32 am

Post by anton »

DSguru2B wrote:You are replying to a post that was last answered in Jun 06.
i know. this is asynchronous communication, plus this is a common problem.
Post Reply