How to split record
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 111
- Joined: Thu Jun 01, 2006 5:12 am
- Location: Detroit
How to split record
Hi,
My requiremnt is , I have 1 record in source file and I need to write that to target as 2 records , that means that single record needs to be split into 2 records
Example:
Input is
******* Single record
Col1 col2 col3 col4
a 1 3 4
Output:
****** 2 records
a 1 3
a 4
Like this, Pls help me how to implement in data stage.
Thanks in Advance.
My requiremnt is , I have 1 record in source file and I need to write that to target as 2 records , that means that single record needs to be split into 2 records
Example:
Input is
******* Single record
Col1 col2 col3 col4
a 1 3 4
Output:
****** 2 records
a 1 3
a 4
Like this, Pls help me how to implement in data stage.
Thanks in Advance.
kOTI,
1586-738-7785
1586-738-7785
YOu can do it a couple of different ways.
One way would be to read the file twice using two different sequential file stages, stick a transformer after them. Choose Col1, Col2 and Col3 for the first stream and Col1 and Col4 from the second stream. You can then write it a sequential file (1 from each stream) and in after job subroutine do a cat, or stick a funnel stage and gather the records. But with the funnel stage you will have to specify a dummy column for your second stream so as to make the meta data similar.
One way would be to read the file twice using two different sequential file stages, stick a transformer after them. Choose Col1, Col2 and Col3 for the first stream and Col1 and Col4 from the second stream. You can then write it a sequential file (1 from each stream) and in after job subroutine do a cat, or stick a funnel stage and gather the records. But with the funnel stage you will have to specify a dummy column for your second stream so as to make the meta data similar.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 111
- Joined: Thu Jun 01, 2006 5:12 am
- Location: Detroit
Well then give us the complete requirement. Looking at your sample data, it tells me two things.
1)Split a record into two, and
2)First three columns in one record and first and last column in second record.
Now your telling me there are going to be multiple records
Please provide a full description of your requirements.
1)Split a record into two, and
2)First three columns in one record and first and last column in second record.
Now your telling me there are going to be multiple records
Please provide a full description of your requirements.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 111
- Joined: Thu Jun 01, 2006 5:12 am
- Location: Detroit
Thanks Guru,
In the same manner we may have more then 10 input fields and like that we need to split single record into 10 output records, The main thing we need to split record, that's all....Can any body tell me how to implement this splitting record scenario in data stage
Thanks in Advance
In the same manner we may have more then 10 input fields and like that we need to split single record into 10 output records, The main thing we need to split record, that's all....Can any body tell me how to implement this splitting record scenario in data stage
Thanks in Advance
kOTI,
1586-738-7785
1586-738-7785
So basically the number of splits should be dynamic. What column in the source record will tell how many records need to be created?
Can you please give two proper examples with data. How the incoming record will look like and on what basis it will be split and on what basis to decide what column goes into what record.
Need requirements man. If I am not able to provide the correct answer, others who can, need this info.
Can you please give two proper examples with data. How the incoming record will look like and on what basis it will be split and on what basis to decide what column goes into what record.
Need requirements man. If I am not able to provide the correct answer, others who can, need this info.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
For splitting one record into multiple record, the easiest way I can think of will be put a copy stage after reading the data, from copy stage drag the fields you want in the first record link and drag the fields for the second record link and so on for N number of records links.
After this for merging them, u need to put a funnel stage which will merge them.
The only point that you need to keep in mind that each record link coming out of the copy stage which is going to be input for the funnel should have similar meta-data.
After this for merging them, u need to put a funnel stage which will merge them.
The only point that you need to keep in mind that each record link coming out of the copy stage which is going to be input for the funnel should have similar meta-data.
Regards,
Novneet Jain
Novneet Jain
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: