How to pass column name instead of value?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
chalasaniamith
Participant
Posts: 36
Joined: Wed Feb 16, 2005 5:20 pm
Location: IL

How to pass column name instead of value?

Post by chalasaniamith »

Hi All,
Is there any way to pass the column name instead of the vlaues comming in I dont need the values i just need the column name to pass.
Ex:
seq file -> tx -> seqfile
i want to pass 1st columnname from seqfile to transformer instead of value.
Amith Chalasani
Infosphere Solution Architect & Admin
Northern Trust
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

Do you mean pass the column name from the table definiton of the source file? Can you be more specific....
chalasaniamith
Participant
Posts: 36
Joined: Wed Feb 16, 2005 5:20 pm
Location: IL

Post by chalasaniamith »

yes thats true i want to pass the column name from table definition..
Amith Chalasani
Infosphere Solution Architect & Admin
Northern Trust
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

chalasaniamith wrote:yes thats true i want to pass the column name from table definition..
Is the table definiton for the file saved in the repository? In which case why dont you hardcode the column name in a Column generator and generate an additional column before sending it to the transformer?

Since your requirement - why you need this column name - is not clear, it would be difficult to give you an optimal solution.
Last edited by thebird on Thu Dec 07, 2006 7:56 pm, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not possible.

You could create some logic to read it from the schema file, if you are using a schema file to describe the structure of data in the source text file. But there is no mechanism for passing metadata when DataStage expects that you are passing data.

After all, the column name is a property of the link; it should already be there in the Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chalasaniamith
Participant
Posts: 36
Joined: Wed Feb 16, 2005 5:20 pm
Location: IL

Post by chalasaniamith »

bcoz you want pass rest of values in the file except for one column i need to pass the column name.so i dont think it will work.
Amith Chalasani
Infosphere Solution Architect & Admin
Northern Trust
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

chalasaniamith wrote:bcoz you want pass rest of values in the file except for one column i need to pass the column name.so i dont think it will work.
Yeah, then I guess you will have to work as Ray has hinted...
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

bcoz you want pass rest of values in the file except for one column i need to pass the column name.


Since your source is a single file, why not use a UNIX command (perhaps CUT) in an External Source stage to read everything except for the First column and then pass downstream. You can make this ommit any of your fields from being passed to the next stage.

Aneesh
aakashahuja
Premium Member
Premium Member
Posts: 210
Joined: Wed Feb 16, 2005 7:17 am

Post by aakashahuja »

Or to add to the above mentioned solutions, you can get the column names from the database catalogue tables and pass them downstream just like any other data. Later another operation (like the one suggested by thebird) could be used to pass down the required set of data which you can later merge with what you had received earlier.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Except that sequential files don't have "catalogue tables".
:oops:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jgreve
Premium Member
Premium Member
Posts: 107
Joined: Mon Sep 25, 2006 4:25 pm

Re: How to pass column name instead of value?

Post by jgreve »

chalasaniamith wrote:Hi All,
Is there any way to pass the column name instead of the vlaues comming in I dont need the values i just need the column name to pass.
Ex:
seq file -> tx -> seqfile
i want to pass 1st columnname from seqfile to transformer instead of value.



note: It would help you get better answers if we
knew _why_ you wanted to do this.

If I had to do what you're describing, I would
try to talk my clients out of it.

Failing that, how does this sound?
I'm assuming that your input file has column-headers in
the first record. If it doesn't, you'll need another
place to get them from.

Make seqfile_in and head read from the same file.
Tell seqfile_in that the file contains header-info.
Tell head the file DOES NOT contain header info (oh
yeah - also tell head to load only 1 record).
Kinda like this:

Code: Select all

  seqfile_in --> lookup --> tx --> seqfile_out
                  /|\
                   |
   head------------+
If you need to "lookup" different column names, then
maybe splitting your cols-to-rows and loading the lookup
info from that would work.

Anyway, good luck.
John G.
chalasaniamith
Participant
Posts: 36
Joined: Wed Feb 16, 2005 5:20 pm
Location: IL

Re: How to pass column name instead of value?

Post by chalasaniamith »

thanks its worked arround..
Amith Chalasani
Infosphere Solution Architect & Admin
Northern Trust
Post Reply