Page 1 of 1

Handling ENTER values from source data

Posted: Thu Dec 30, 2004 12:14 pm
by ramesh_dw
Hi all,

I am having a problem in handling carriage return values("ENTER") in the data.

I am having a source in which a column might have "ENTER" keys in between the column value.It has to be removed.

I tried by converting the column values to ASCII and removing the "ENTER" equivalents of ASCII. But I am not able to convert the ASCII back into characters.

Example:

column
abc"ENTER"def
pqrstuv

Any suggestions please...

Posted: Thu Dec 30, 2004 12:34 pm
by ArndW
Hello Ramesh,

if you look at your column definitions for you file you will see a column titled "data contains terminators" - that will solve your problem; "terminators" are synonymous with what you call "ENTER" (which may be <CR><LF> or just <LF> depending on your system)

Posted: Thu Dec 30, 2004 12:41 pm
by phanee_k
HI ,
You can use Ereplace function

Ereplace(ColumnNAme,char(13),'')

This replaces the Enter Char( char(13) ) with the empty space.

You can also Use OConv(ColumnName,"MCP"). This argument converts the non printable characters to a " . " . Again replace the " . " with what ever character you want using Ereplace function.

HTH,
Phani

Posted: Thu Dec 30, 2004 12:44 pm
by ramesh_dw
ArndW wrote:Hello Ramesh,

if you look at your column definitions for you file you will see a column titled "data contains terminators" - that will solve your problem; "terminators" are synonymous with what you call "ENTER" (which may be <CR><LF> or just <LF> depending on your system)
The source is a RDBMS table and I am writing the data into a sequential file. bcos of these "terminators" the number of rows in the target file is more than the number of rows in the source table. So I have to handle the terminators by manipulating data.

Posted: Thu Dec 30, 2004 1:01 pm
by ArndW
I see - then Phani's response is the correct way. If you think you might have other unprintable characters, then use an OCONV with "MCP" conversion that converts all unprintable characters to a period "."; I often use this when my source data is suspect.

Posted: Thu Dec 30, 2004 1:19 pm
by chulett
Either way should work. If you are generating the flat file data yourself, then you have the option of removing the offending characters on the way down - then it's not an issue for the job reading the resulting file.

If you're stuck with sequential file data with line terminators in data fields, then Arnd's advice should work as well. In the Columns tab of the Sequential File stage, slide the display over to the right and you'll find some extra (somewhat hidden) fields. For the fields with the data in them that causes the record to end eary, set the 'Contains Terminators' entry to yes and DataStage should just include that as part of the data instead of treating it as a record terminator.