Highlighted
Absent Member.
Absent Member.
345 views

[archive] Line Feeds in text fields

[Migrated content. Thread originally posted on 07 September 2007]

We have a GUI that we've developed using AcuBench. In one of the fields we allow users to enter free text. This text gets written into the database for later retrieval and display when necessary. This has been working fine without any problems.

However, now we need to port the data to an Oracle Database from our ancient Allbase database. The problem is that when we build the flat files to port over to Oracle the line feed characters are playing havoc with our process. When the line sequential output is written the line feeds get written with it.

I've tried using sed's on the data after it's created and COBOL inspect/replace commands to try to replace the line feeds before the records are created. But eventhough I can replace the line feeds, the data to the right of the line feeds shows up in the flat file on a separate line - as if the line feed was still there.

Data typed in like this:
Hi. My name is Jeff. I am a
computer programmer

Gets stored in the database as one field like this:
Hi. My name is Jeff. I am a ^M computer programmer

But gets written to the line sequential output file as 2 records like this:
Hi. My name is Jeff. I am a
computer programmer

If I run a sed against the file I can get rid of the line feeds but I can't concatenate the lines back together.

Has anyone solved this problem before?

Thanks,
John
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Line Feeds in text fields

You might want to consider that there is probably both line feeds (ascii 10) and carriage returns (ascii 13). I presume your problem is that you only handle one of them. If this is the case, remove both and I would expect you to be okay.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Line Feeds in text fields

First I'd like to say that I'm glad you're still here Gisle. You are a huge asset for all of us.

I did strip the carriage return and line feed and still had a problem. Then I looked at the data in HEX and noticed that there was a carriage return before and after every line feed. When I accounted for that fact I solved the problem.

Your assessment was correct Gisle. Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Line Feeds in text fields

Happy to hear your problem is resolved John. 🙂
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.