Page 1 of 1

How do I capture the name of my source FILE thru datastage.

Posted: Fri Feb 24, 2006 5:45 pm
by Shailendra
Hi ,

I need to capture my source file name and pick the date from it and append to my target. I read in the forum that parallel sequential file stage has an option called "File Name Column" where it captures the file name.

Iam using server sequential stage. Is there any method to do this through datastage or any other suggestion is welcome.

File name that Iam reading data from is

20051231-235500_20060101-051404... I need to pick the date (ie)

"20051231" from the above file name.


Thanks in advance,
Shailendra

Posted: Fri Feb 24, 2006 6:31 pm
by I_Server_Whale
How is the source file being passed to the sequential file stage? It seems to me that your source file name is dynamic, meaning it is changing each time you run your job.

Are you passing the file name through a job parameter to the sequential file stage??

Please explain your job elaborately.

Thanks,
Naveen.

Posted: Fri Feb 24, 2006 7:02 pm
by I_Server_Whale
Hi Shailendra,

Welcome aboard!!! :lol: Didn't notice that this was your first post. :idea:

Naveen.

Posted: Mon Feb 27, 2006 10:38 am
by MaheshKumar Sugunaraj
Hi Shilendra,

Welcome aboard!!!

U could do this in the following way:

1. Use a Sequential file and in this check the option "Stage uses Filter Command",

2. then in the file path pass "/dev/null"

3. pass the filter command "ls -l <directorypath>/*", (Hopefully u have only one file coming)

4. Read the entire file

5. then u would be having the name the file and use Stage variable to extract the information u want and process accordingly.

The above should be ur frist step and then process the entrie file accordingly.

Hopefully the above helps. Best of luck :)

With Regards
Mahesh

Posted: Mon Feb 27, 2006 10:40 am
by MaheshKumar Sugunaraj
Hi Shilendra,

Welcome aboard!!!

U could do this in the following way:

1. Use a Sequential file and in this check the option "Stage uses Filter Command",

2. then in the file path pass "/dev/null"

3. pass the filter command "ls -l <directorypath>/*", (Hopefully u have only one file coming)

4. Read the entire file

5. then u would be having the name the file and use Stage variable to extract the information u want and process accordingly.

The above should be ur frist step and then process the entrie file accordingly.

Hopefully the above helps. Best of luck :)

With Regards
Mahesh

Posted: Mon Feb 27, 2006 10:42 am
by MaheshKumar Sugunaraj
Apologies for Posting twice.

Regards
Mahesh

Posted: Mon Feb 27, 2006 10:55 am
by kumar_s
MaheshKumar Sugunaraj wrote:Apologies for Posting twice.

Regards
Mahesh
You could have deleted the second one :wink:

Posted: Mon Feb 27, 2006 11:00 am
by kumar_s
The same can also be acheived by Before Job subroutine.
/path/ls -1 > {File Name}
And use this {File Name} in your input stages.
ls -1 would give you less work than ls -l.

Posted: Mon Feb 27, 2006 3:56 pm
by Shailendra
Hello Naveen and Mahesh,

Sorry for replying late. I didnt have a chance to check my email or the site. Thank you very much for your replies. I will try them out and let you know about it.
I have been working heavy on informatica but this my first time in Datastage. So will be logging into the site more often. Good to meet you guys.

Thanks again,
Shailendra