Handling ENTER values from source data

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ramesh_dw
Participant
Posts: 21
Joined: Tue Mar 23, 2004 10:44 pm
Location: Chennai

Handling ENTER values from source data

Post 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...
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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)
phanee_k
Charter Member
Charter Member
Posts: 68
Joined: Thu Nov 20, 2003 11:02 pm

Post 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
ramesh_dw
Participant
Posts: 21
Joined: Tue Mar 23, 2004 10:44 pm
Location: Chennai

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply