adding column names to reject file
Moderators: chulett, rschirm, roy
adding column names to reject file
Hi,
I have a requirement of having column names in addition to data in a file.
Any inputs as to how to do this will be of great help.
regards
ssunda
I have a requirement of having column names in addition to data in a file.
Any inputs as to how to do this will be of great help.
regards
ssunda
-
- Participant
- Posts: 222
- Joined: Tue Aug 30, 2005 2:07 am
- Location: pune
- Contact:
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
ssunda,
I read your original post as requiring column headings in your output file. One way to do this is to use a before-job execSH to echo the column headings to your file (creating the file in the process), then set your sequential file stage to 'append' rows to the file. To avoid name mismatch your filename should be a job parameter which is referenced in your sequential file and ExecSH command.
HTH,
J.
I read your original post as requiring column headings in your output file. One way to do this is to use a before-job execSH to echo the column headings to your file (creating the file in the process), then set your sequential file stage to 'append' rows to the file. To avoid name mismatch your filename should be a job parameter which is referenced in your sequential file and ExecSH command.
HTH,
J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
Are you trying to read from a file which has column names in the header or write in the file and want to have column names in output file in addition the data in the file
Edited to add-
If you reading such file, command filter with tail command can be used to drop the column names while processing.
While writing you can set the property - first line is column names as true.
Edited to add-
If you reading such file, command filter with tail command can be used to drop the column names while processing.
While writing you can set the property - first line is column names as true.
Regards,
S. Kirtikumar.
S. Kirtikumar.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Where's the reject link beginning? Reject links from Sequential File stage, for example, contain only one column, containing the source row as a Raw string. This can certainly be written to a file. But the question of adding additional columns may become tricky - you would need to guarantee that the delimiter characters match those expected from source. And that the record schema managed the raw string and the other columns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Where's the reject link beginning? Reject links from Sequential File stage, for example, contain only one column, containing the source row as a Raw string. This can certainly be written to a file. But the question of adding additional columns may become tricky - you would need to guarantee that the delimiter characters match those expected from source. And that the record schema managed the raw string and the other columns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 83
- Joined: Sat Oct 28, 2006 6:25 am
Re: adding column names to reject file
If I am getting this right! you want to generate the collumn names in the output seq file along with the rejected data and because the meta data format of the reject link is raw you can not set the property 'First Line asd Collumn Name'. I suggest if this is the case better use one more stage and set the property there. I think as data flowing from reject link can be used without modification therefore this shoud work this way!
Hi Ssunda,
If i am getting your ques. right, then ...you are writing from File to File and at transformer you are taking one Reject Sequential file.what i can suggest you is...Hardcord the column name and then concatenate it with your data.
If your Column is TRY the use "TRY":inputlink.col.name.
please correct me if i am worng.
Thanks.
If i am getting your ques. right, then ...you are writing from File to File and at transformer you are taking one Reject Sequential file.what i can suggest you is...Hardcord the column name and then concatenate it with your data.
If your Column is TRY the use "TRY":inputlink.col.name.
please correct me if i am worng.
Thanks.
ambasta
We've now got six replies to the original post (seven if you count Ray's double) all guessing what ssunda's actual problem is. Rather than having any more well intentioned people pile on with their entry into the contest, here's a thought...
Why not wait for the OP to come back and clear things up? It blows my mind how long some of these threads get with only the original post for guidance. That's usually because the original question is just as vague as this one - where the appropriate first response should be a plea for clarification IMHO.
Or just continue to "tawk amongst yourselves".
Why not wait for the OP to come back and clear things up? It blows my mind how long some of these threads get with only the original post for guidance. That's usually because the original question is just as vague as this one - where the appropriate first response should be a plea for clarification IMHO.
Or just continue to "tawk amongst yourselves".
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi all,
sorry for replying so late. I dont have reject link from sequential file. Reject links are from stages like transformer, lookup.
For one of my files I have 150 columns, so hardcoding the column names is difficult.
Iam not reading from files which have column names, instead I am trying to write column names to a reject file along with data.
Thanx for the replies.
regards
ssunda
sorry for replying so late. I dont have reject link from sequential file. Reject links are from stages like transformer, lookup.
For one of my files I have 150 columns, so hardcoding the column names is difficult.
Iam not reading from files which have column names, instead I am trying to write column names to a reject file along with data.
Thanx for the replies.
regards
ssunda
Hi Ssunda,ssunda6 wrote:Hi all,
sorry for replying so late. I dont have reject link from sequential file. Reject links are from stages like transformer, lookup.
For one of my files I have 150 columns, so hardcoding the column names is difficult.
Iam not reading from files which have column names, instead I am trying to write column names to a reject file along with data.
Thanx for the replies.
regards
ssunda
what i can suggest you is...while loading the meta data for filw,you can set the property as [first line is column names] as true.I f you will do that then u can very well see ur column names.and i don't think there is any escape route[Guys! correct me if i m wrong],you will have to Hardcode the col. name then concatenate with values.
Thanks.
ambasta
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Adding column names manually
It's not difficult. It's tedious - not the same thing. It's something you only need to do once. Do it. Save into Repository so it's re-usable.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.