Removing Embedded Carriage Returns

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dstager
Participant
Posts: 47
Joined: Tue Jan 08, 2008 8:43 am

Removing Embedded Carriage Returns

Post by dstager »

DS Gurus,

I am having trouble formatting a sequential file that seems to be scattered with embedded Carriage Returns within the file.

I am reading from source (SQL Server) via ODBC and transferring a column (Varchar 1000) into a sequential file to be loaded into a Mainframe table.

There are some records with 'carrriage returns' that is causing the grief. I would like to REMOVE the carriage returns without affecting the structure of the file (ie - I tried to remove ^M manually - via Unix vi), but it affects the structure of the seq file.

I am creating a fixed width file with Unix delimiter.

Help is appreciated.
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

After writting into a file, you can try to execute
dos2unix <file_name>
that should take care of your problem.
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

After writting into a file, you can try to execute
dos2unix <file_name>
that should take care of your problem.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In your DataStage job use "CONVERT(Char(13),'',In.StringColumn)" to remove internal Control-M characters.
dstager
Participant
Posts: 47
Joined: Tue Jan 08, 2008 8:43 am

Post by dstager »

Thanks!

The problem is resolved - I used the convert (Char(13)) method.
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Hi All,

I have the same problem, I used to create the sequential file form the DB2 database, But some times when i create the file it is created with CR/LF, SO when i try to read the file, The datastage job is aborted.

I have to check the entire file before i read it, Is there any option to check the entire file in datastage to find the carriage reture.

Your help is highly appriciated.

Thanks and Regards
N.Magesh
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

Hi All,

I have the same problem, I used to create the sequential file form the DB2 database, But some times when i create the file it is created with CR/LF, SO when i try to read the file, The datastage job is aborted.

I have to check the entire file before i read it, Is there any option to check the entire file in datastage to find the carriage reture.

Your help is highly appriciated.

Thanks and Regards
N.Magesh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No.

But you can write a script to do that and invoke the script from DataStage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Magesh_bala
Participant
Posts: 86
Joined: Mon Nov 27, 2006 3:42 am
Location: Wilmington

Post by Magesh_bala »

ray.wurlod wrote:No.

But you can write a script to do that and invoke the script from DataStage. ...
Can you please help me in writing the script?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Try and google the keywords "tr command remove carriage return", that will answer your scripting questions.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Magesh_bala wrote:Can you please help me in writing the script?
That comes under the heading of "consulting" which is how I make my living. Contact me off line if you wish to engage me professionally.
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