Extract date part from file name
Moderators: chulett, rschirm, roy
Extract date part from file name
Hai
I have a scenario where i have to strip of date part from the file name
Ex:
Input
method_yyyymmdd.csv
Output
yyymmdd
and want to use it as a default value for one of the column in my target.
Any ideas how to achieve this.
Sree
-
- Participant
- Posts: 57
- Joined: Wed Jan 26, 2005 10:22 pm
- Location: India
hi Srekant,
if you are using Job parameters then you need to pass the date part in the file name as Job parameter.
now it depends on how you are invoking your job if it is through a unix script
then use cut command to get date, which you have already done it.
When you invoke your job using dsjob utility pass this date value as a job parameter value as
JobParam=dd-mm-yyyy , i.e as name=value pair.
This job parameter can be used in your transformer.
In transformer column derivations on right click you can choose Job Parameters and from the list pick the job parameter.
Thus you can access the parameter value.
Other wise may have to use job Control or sequencer to pass the date value to the job as a parameter.
if you are using Job parameters then you need to pass the date part in the file name as Job parameter.
now it depends on how you are invoking your job if it is through a unix script
then use cut command to get date, which you have already done it.
When you invoke your job using dsjob utility pass this date value as a job parameter value as
JobParam=dd-mm-yyyy , i.e as name=value pair.
This job parameter can be used in your transformer.
In transformer column derivations on right click you can choose Job Parameters and from the list pick the job parameter.
Thus you can access the parameter value.
Other wise may have to use job Control or sequencer to pass the date value to the job as a parameter.
Happy DataStaging
Hi,
What DS version your on?
If 7.5 or better yuo can use a sequence job to run a command returning the file name and use User Variable stage to define a variable holding the date by using basic routines and pass this variable as a parameter to your job.
If your using automaticly handle activities that fail you'll probably need to use a server job to return this info via user status and use that as the parameter value.
IHTH,
What DS version your on?
If 7.5 or better yuo can use a sequence job to run a command returning the file name and use User Variable stage to define a variable holding the date by using basic routines and pass this variable as a parameter to your job.
If your using automaticly handle activities that fail you'll probably need to use a server job to return this info via user status and use that as the parameter value.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org