How to Capture File Name from Sequential File Stage
Moderators: chulett, rschirm, roy
How to Capture File Name from Sequential File Stage
Hi Guys,
I need to capture File Name from Sequential File stage by any means. Its little tough because I am not passing the file name as parameter it's hard-coded along with path. Any info will be appericated.
thanks,
I need to capture File Name from Sequential File stage by any means. Its little tough because I am not passing the file name as parameter it's hard-coded along with path. Any info will be appericated.
thanks,
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Hi,
Are you saying that you have to capture the filename from the path name?
For ex:
If thats the case, then you use the DCOUNT function to count the delimiter "\" and then use the FIELD function to extract the last field which is nothing but the filename .
Let me know how it went.
Thanks!
Naveen.
Are you saying that you have to capture the filename from the path name?
For ex:
Code: Select all
Path= c:\xyz\abc\pqr\filename.ext
Let me know how it went.
Thanks!
Naveen.
There is no API for requesting such information. The only thing you can do is trick the job into telling you this information thru the job log, which you can then query using the API DSGetLogSummary. Unfortunately, most of those messages tend to be fatal.
I think you need to revisit why the file name is not parameterized and shared with other processes. Your task is most difficult.
I think you need to revisit why the file name is not parameterized and shared with other processes. Your task is most difficult.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
How to Capture File Name from Sequential File Stage
The job log doesn't tell what is the output file name that you have defined inside the stage....kcbland wrote:There is no API for requesting such information. The only thing you can do is trick the job into telling you this information thru the job log, which you can then query using the API DSGetLogSummary. Unfortunately, most of those messages tend to be fatal.
I think you need to revisit why the file name is not parameterized and shared with other processes. Your task is most difficult.
np
Cheater, I assumed the file is fully qualified and stage/link names can't have slashes, dashes, dots, just underscores.manteena wrote:Hardcode the filename as the stage name, then get the stage name with DSGetStageInfo.......
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Re: How to Capture File Name from Sequential File Stage
It does if the file to be opened can't be opened, or there's some other catastrophic issue, hence my reply that the file name only shows up under tragic circumstances.dilsere2 wrote: The job log doesn't tell what is the output file name that you have defined inside the stage....
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Re: How to Capture File Name from Sequential File Stage
Tell what you think of this? After job is sucessfully completed i will write a BASIC codoe to export the file to get dsx file name then write script to pharse out the FileName...You guys have any other ideas...kcbland wrote:It does if the file to be opened can't be opened, or there's some other catastrophic issue, hence my reply that the file name only shows up under tragic circumstances.dilsere2 wrote: The job log doesn't tell what is the output file name that you have defined inside the stage....
np
Why does this sound like a variable value everytime the job runs, but is hardcoded? This makes no sense. Is someone changing this filename, compiling it, and running it? Can you at least get them to write it to an empty directory and then assume anything in that directory is the file you want?
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
You might just have the winning suggestion! :Dmanteena wrote:An XML job report will give you the file name with Directory name of the source or target file stages....try to read this report for filename...
NO CHEATING
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Code: Select all
select
EVAL DS_JOBOBJECTS."@RECORD<6>" AS FILE_NAME FMT '45L',
DS_JOBS.NAME AS JOB_NAME FMT '35L',
DS_JOBOBJECTS.NAME AS LINK_NAME FMT '35L'
from
DS_JOBOBJECTS,
DS_JOBS
where
DS_JOBOBJECTS.OLETYPE in ('CSeqOutput','CSeqInput')
and DS_JOBOBJECTS.OBJIDNO = DS_JOBS.JOBNO
group by
FILE_NAME,
JOB_NAME,
LINK_NAME
;
Mamu Kim