Trim

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
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

Trim

Post by just4u_sharath »

Guys,
I have an issue with the data that is loaded in to the sequential file.

1) 10161|000471276|Baja||||||||||||TX||4|0
2) 10175|000471276|Baja||||||||||||TX||4|0
3) 10161|000474056
|Baja||||||||||||TX||4|0
4) 10175|000474056
|Baja||||||||||||TX||4|0.

I am getting that extra spaces or line for the 3rd and 4th rows. Except for these 2 rows entire file is proper. I have used TRIM and TRIMB function in the transformer for the 2nd column still i am getting the error. TRIMB(DB_Data.DUNS). The data type for this column is defined as varchar(30).

thanks
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Pre process your file and then run your job

Code: Select all

$ cat file
10161|000471276|Baja||||||||||||TX||4|0
10175|000471276|Baja||||||||||||TX||4|0
10161|000474056
|Baja||||||||||||TX||4|0
10175|000474056
|Baja||||||||||||TX||4|0
$ awk -F"|" ' NF != 18 { a=$0; getline;$0=a$0 } ; 1 ' file
10161|000471276|Baja||||||||||||TX||4|0
10175|000471276|Baja||||||||||||TX||4|0
10161|000474056 |Baja||||||||||||TX||4|0
10175|000474056 |Baja||||||||||||TX||4|0
You are the creator of your destiny - Swami Vivekananda
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Re: Trim

Post by arunkumarmm »

just4u_sharath wrote:Guys,
I have an issue with the data that is loaded in to the sequential file.

1) 10161|000471276|Baja||||||||||||TX||4|0
2) 10175|000471276|Baja||||||||||||TX||4|0
3) 10161|000474056
|Baja||||||||||||TX||4|0
4) 10175|000474056
|Baja||||||||||||TX||4|0.

I am getting that extra spaces or line for the 3rd and 4th rows. Except for these 2 rows entire file is proper. I have used TRIM and TRIMB function in the transformer for the 2nd column still i am getting the error. TRIMB(DB_Data.DUNS). The data type for this column is defined as varchar(30).

thanks
Yes. That is not a space. It seems to be a line terminator.
Arun
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

Post by just4u_sharath »

I am getting a new line character in the data so i am using Ereplace function to replace newline character with ''
TRIM(Ereplace(Ereplace(DB_Data.DUNS , CHAR(10), ''), CHAR(13), '')).
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If the values are quoted you can use the "contains terminators" property in the Columns grid of a Sequential File stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply