Replacing Carriage Returns in fields
Moderators: chulett, rschirm, roy
Replacing Carriage Returns in fields
Firstly apologies if this is simple to do, or already has been explained.
Basically what I need to do is replace all carriage returns in a fixed width file (other than those that fall at end of the rows). Preferable without playing around with the metadata.
Any help or guidance on this problem would be greatly appreciated.
Thanks for yor time
tjmalone
Basically what I need to do is replace all carriage returns in a fixed width file (other than those that fall at end of the rows). Preferable without playing around with the metadata.
Any help or guidance on this problem would be greatly appreciated.
Thanks for yor time
tjmalone
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Be careful if you're really on Windows, which your original post specifies. The Windows line termination sequence is actually two characters, made up of a line feed and a carriage return.
Since Convert() only does character-by-character conversion, you would definitely need Ereplace() - which does substring substitution - or Change() which is a subset of Ereplace() functionality.
Since Convert() only does character-by-character conversion, you would definitely need Ereplace() - which does substring substitution - or Change() which is a subset of Ereplace() functionality.
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: 197
- Joined: Mon Feb 17, 2003 11:20 pm
- Location: India
Hi tjmalone, did it work for you. If yes could you please send me the exact that you used. Actually we were facing a similar issue in our project but we didn't know using EReplace or Convert how do we first read a CR or LF value. So, what we did was we used Iconv Oconv to convert them to ASCII, removed CR and LF and converted them back to normal form. After going through this post I feel there could be an easier way achieve it. Would really appreciate if you could send me the exact code that you have used.tjmalone wrote:Thanks for the help
Thanks in advance,
-Sumit
-
- Participant
- Posts: 197
- Joined: Mon Feb 17, 2003 11:20 pm
- Location: India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Well, the job actually got assigned to some one else, but one option i was considering is bringing the table in as a single stream, removing all line breaks, carriage returns. And then calling a created routine that loop throughs using a substring based on the job parameter specifying the width of the complete row (fixed width table), and then adding a carriage return to it.
Though never actually tried this. And not sure how it would go, as i've quite new to this.
Though never actually tried this. And not sure how it would go, as i've quite new to this.