I have data in a sequential file. My data look like this:
25UB|23435
25XZ|89435
25MB|46377
25MD|38204
25YN|32048
I want to convert this data to:
25UB|23435|25XZ|89435|25MB|46377|25MD|38204|25YN|32048
Thanks
Merging rows into a string
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 6
- Joined: Tue Jul 13, 2004 7:40 am
Re: Merging rows into a string
Vigneshra,
Could you please explain how to know that job has reached the last row of the input file and how to pass only the last appended row?
I had faced the similar problem, and I solved it creating a new column appending each row values using a stage variable as Vigneshra mentioned. This gives me concatanated row values at the last row of my new column. However, I donot know how to determine the end of the input file to pass only the last row. That's why I passed all the rows and created a sequential file. Then I created a hash file taking the sequential file as input just to get the last row.
I feel my design is not the best one but still it works.
Thanks,
Somesh
Could you please explain how to know that job has reached the last row of the input file and how to pass only the last appended row?
I had faced the similar problem, and I solved it creating a new column appending each row values using a stage variable as Vigneshra mentioned. This gives me concatanated row values at the last row of my new column. However, I donot know how to determine the end of the input file to pass only the last row. That's why I passed all the rows and created a sequential file. Then I created a hash file taking the sequential file as input just to get the last row.
I feel my design is not the best one but still it works.
Thanks,
Somesh
I did like this:
I declared two stage variables...mergedRow, i, and totalRecCount
mergedRow = If @INROWNUM = i Then InputLink.col1 else mergedRow: InputLink.col1
i = i+1 (i has initial value 0)
Now, in the output link from the transformer, I put a constraint @INROWNUM = totalRecCount
I am getting totalRecCount through Aggregator, Merge to the transformer.
This output only the last fully merged record with out having to store the data in a file.
I declared two stage variables...mergedRow, i, and totalRecCount
mergedRow = If @INROWNUM = i Then InputLink.col1 else mergedRow: InputLink.col1
i = i+1 (i has initial value 0)
Now, in the output link from the transformer, I put a constraint @INROWNUM = totalRecCount
I am getting totalRecCount through Aggregator, Merge to the transformer.
This output only the last fully merged record with out having to store the data in a file.