Hi All,
I have one flat file which has 3 columns. I have mentioned below the metadata of the file.
ColumnName DataType
Name Varchar 6
Salary Varchar 6
Company Varchar 6
My problem is There is no delimiter in any one of the records. All the records are in sameline.
Ex:
Pravin50000GoogleMoses70000Target
Above I mentioned just for 2 records. Like that It may have many number of records.
Now I need to split the each record one by one and store the corresponding records into corresponding columns.
Hope I have clearly explained my problem to you people
Any help is really appreciated.
I need my output
Name Salary Company
Pravin 50000 Google
Moses 70000 Target
This file is a fixed length
Split the Record...
Moderators: chulett, rschirm, roy
Split the Record...
prabakaran.v
Re: Split the Record...
Hi praburaj,praburaj wrote:This file is a fixed length
can't be: If You can have hundreds of tuples within a single line, the line will most likely not be fixed length. If the tuples themselves are, then read the file in fixed-length mode and your problem is solved.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
There are the grateful those are happy." Francis Bacon
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Is the Capitalization always as you show? Then a before-job subroutine (or a routine invoked from a Routine activity in a sequence) could pre-process the data stream into a "regular" file with one record per line.
Algorithm (first guess)
Read entire file as a string.
Pre-read the first Name and Salary
Read the next CompanyNameSalary string
Concatenate
Process the tuple
Adjust the string and tuple but removing what was just processed from the left hand end.
Write tuple to new file.
Repeat until end of file
Algorithm (first guess)
Read entire file as a string.
Pre-read the first Name and Salary
Read the next CompanyNameSalary string
Code: Select all
MatchField(TheString, "0A0N0X",1) : MatchField(TheString, "0A0N0X", 2)
Process the tuple
Code: Select all
Name is MatchField(Tuple, "0A0N0A", 1)
Company is MatchField(Tuple, "0A0N0A", 3)
Salary is MatchField(Tuple, "0A0N0A", 2)
Write tuple to new file.
Repeat until end of file
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.