how to read selected rows using sequential file
Moderators: chulett, rschirm, roy
how to read selected rows using sequential file
i have data like
table
empno ename
10 sri
20 rama
10 hari
20 krishna
i want to read only empno 10 by using sequential file
table
empno ename
10 sri
20 rama
10 hari
20 krishna
i want to read only empno 10 by using sequential file
-
- Participant
- Posts: 148
- Joined: Thu Apr 10, 2008 12:47 am
-
- Premium Member
- Posts: 892
- Joined: Thu Oct 16, 2003 5:18 am
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
You can constraint in the source by applying a filter of
Code: Select all
grep '^10 ' yourFileName
More obvious and 'DataStage like' to simply constrain things after the file is read to only pass rows where the value in that column is 10. Something has to 'read' the entire file (being sequential media and all) so why not your job? Then (as a general comment) you don't have to worry about what to put in the Filter that will uniquely identify the proper rows, or if someone later will notice or even understand it, blah blah blah.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Hello, if I am reading this right, you desire to read in only one column out of four from the input sequential file.
Please try this and see if this is useful:
1. Import table definition.
2. Import into sequential file stage only the column you require as you have the option of excluding columns from the full table definition.
Hope this is understandable and useful.
Please try this and see if this is useful:
1. Import table definition.
2. Import into sequential file stage only the column you require as you have the option of excluding columns from the full table definition.
Hope this is understandable and useful.
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
This is not what the OP wants. I agree with Sainath's solution of having a filter command within the Sequential file stage. This should meet your requirements.Bongo51 wrote:Hello, if I am reading this right, you desire to read in only one column out of four from the input sequential file.
Please try this and see if this is useful:
1. Import table definition.
2. Import into sequential file stage only the column you require as you have the option of excluding columns from the full table definition.
Hope this is understandable and useful.
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
But you CAN pick and choose your rows using a Filter command such as grep.
Actually, you *could* pick and choose columns as well by shifting to an External Source stage and using something like awk or sed.
Actually, you *could* pick and choose columns as well by shifting to an External Source stage and using something like awk or sed.
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.