Transformer Stage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

Transformer Stage

Post by naren6876 »

Hi
Is there a way to pass the filename being loaded from a sequential file stage into a transformer stage in order to have the filename included as an output field?

Thanks in advance for your help.

Naren
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Re: Transformer Stage

Post by bchau »

naren6876 wrote: Is there a way to pass the filename being loaded from a sequential file stage into a transformer stage in order to have the filename included as an output field?
A ghetto way of doing it would be to set a job parameter with the file name and output a column with the filename....you could also input it manually without the parameter.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Only if you used a job parameter as the filename, then the job parameter is also available in the transformer. Otherwise, unless you are willing to use an reverse-engineered method for retrieving job design information, no.
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
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

Post by naren6876 »

How to set a filename as a job parameter?
please explain me

thanks,
naren
kcbland wrote:Only if you used a job parameter as the filename, then the job parameter is also available in the transformer. Otherwise, unless you are willing to use an reverse-engineered method for retrieving job design information, no.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Add the filename as a job parameter, for example. FRED. At runtime, supply FRED a value using the smart job control you are working on. In the Sequential stage under the filename, use FRED like this:

Code: Select all

/path/path/path/#FRED#.dat
or you can have the path already in the parameter value so just:

Code: Select all

#FRED#.dat
or you can even have the extension in the parameter value so just:

Code: Select all

#FRED#
In the transformer stage, you can just use FRED literally in the column derivation.
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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can achieve this using FOLDER stage attached to your file. One of the property of the Folder is to return the filename it is currently operating on.
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

Post by naren6876 »

hi
naren6876
Participant
Posts: 233
Joined: Mon Feb 07, 2005 7:19 pm

Post by naren6876 »

Thanks Ken.It works fine for me.
I have a folder which contains filenames.
Now i want to pass this Filenames at runtime.How can i implement this?

Any clues pls

Naren

kcbland wrote:Add the filename as a job parameter, for example. FRED. At runtime, supply FRED a value using the smart job control you are working on. In the Sequential stage under the filename, use FRED like this:

Code: Select all

/path/path/path/#FRED#.dat
or you can have the path already in the parameter value so just:

Code: Select all

#FRED#.dat
or you can even have the extension in the parameter value so just:

Code: Select all

#FRED#
In the transformer stage, you can just use FRED literally in the column derivation.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
I generally prefer a basic routine to gain list of files from a directory,
for 2 reasons:
1. folder stage should not be used if the diretory contains directories.
2. folder stage might fail with large files (varies per configuration, usually over 100MB or so).

a search in this forum should get you the basic code you need to do the job.

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
Image
Post Reply