Page 1 of 1

Capturing File name of the file being loaded

Posted: Tue Jun 06, 2006 11:04 am
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

Posted: Tue Jun 06, 2006 12:13 pm
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.

Re: Capturing File name of the file being loaded

Posted: Tue Jun 06, 2006 5:09 pm
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

Re: Capturing File name of the file being loaded

Posted: Thu Dec 28, 2006 4:26 pm
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

Posted: Thu Dec 28, 2006 4:28 pm
by DSguru2B
You are replying to a post that was last answered in Jun 06.

Posted: Thu Dec 28, 2006 4:29 pm
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.