Hi ...
We are receiving mainframe files, sent to our unix server comma delimited, and with "'s as our quote characters. We have noticed that within the data, in some rare circumstances there are line terminators. We have dealt with this issue by setting the line terminators property to 'yes' in the source sequential file stage on the suspect column. This works, and DS as a result is able to read the data properly.
The problem is, after doing some transformations etc, we land the data into sequential files to be used by DB2 Import. DB2 Import fails, as the data is still containing these line terminators which obviously creates broken lines.
Does anyone know of a solution to this problem ... we basically want DS to eliminate this Line Terminator as it writes out the data to the target sequential file ?
We figure we are stuck coming up with a genius routine.
Thanks a lot ...
Line Terminators
Moderators: chulett, rschirm, roy
You need to remove the terminators before you land the data. Probably the simplest way is to use the Ereplace function to either turn them into spaces or remove them all together. Depending on if you are removing LFs or CR/LF pairs (or whatever), you could do it a couple of different ways:
The first one replaces line feeds with a space while the second replaces every CR/LF pair with a single space. Close the quotes to remove the characters, essentially replacing them with nothing.
Code: Select all
EReplace(TheField,CHAR(10)," ",-1,0)
EReplace(TheField,CHAR(13):CHAR(10)," ",-1,0)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Single character replacements are more efficiently handled using the Convert function rather than Ereplace.
Also for efficiency, initialize a stage variable (or a constant in code, using Equate) so that Char(10) is only evaluated once.
Also for efficiency, initialize a stage variable (or a constant in code, using Equate) so that Char(10) is only evaluated once.
Code: Select all
Convert(svLF," ",TheField)
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.
CR/LF Problem
I am sending data from SQL server to Flat file, I am facing problem with line feed . I am using this function Convert(svLF,"", DSLink3.address2). Is this syntax is correct? I transformer it showing error.ray.wurlod wrote:Single character replacements are more efficiently handled using the Convert function rather than Ereplace.
Also for efficiency, initialize a stage variable (or a constant in code, using Equate) so that Char(10) is only evaluated once.Code: Select all
Convert(svLF," ",TheField)
Re: CR/LF Problem
The following OConv conversion will replace all control characters by a "."
OConv(The Field,"MCP")
Smitha
OConv(The Field,"MCP")
Smitha
Smitha Jacob