Control M characters in Sequential File

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
gaya3
Participant
Posts: 42
Joined: Wed Jun 08, 2005 12:34 am

Control M characters in Sequential File

Post by gaya3 »

Hi,

I have written a job control to capture the job summary using DSMakeJobReport and to write this information to a sequential file in a loop (for each job).

I am able to see the expected result in the output flat file, but I also see ^M characters at the end of each line in the output.

Can anyone please suggest a way to remove these charcters in the output?
DSDexter
Participant
Posts: 94
Joined: Wed Jul 11, 2007 9:36 pm
Location: Pune,India

Re: Control M characters in Sequential File

Post by DSDexter »

There are various ways of removing the ^M characters. Simplest one is to use the dos2unix utility.

This will work...Just in case if it doesnt, use the tr utility of unix. Use the following command to remove the ^M characters. You can use this commands in a before job routine and strip the unwanted character.

Code: Select all

tr -d '\r' < yourfile.txt > yourfile1.txt
mv yourfile1.txt yourfile.txt
Thanks
DSDexter
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Change the line terminator in Sequential File stage from DOS-style to UNIX-style (it's a stage property).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Infact it is to change FROM Unix TO DOS terminator.
gaya3
Participant
Posts: 42
Joined: Wed Jun 08, 2005 12:34 am

Post by gaya3 »

Hi Ray, Iam not using a Sequential File Stage. I have used OpenSeq and WriteSeq commands to write to a flat file in a Job Control.

Is there an option to avoid the occurence of ^M characters while writing to the file itself? I would not prefer to remove the characters after the file has been created, because this job is going to be run as part of the main sequencer everyday.
mandar84
Participant
Posts: 6
Joined: Sat Aug 18, 2007 4:32 am

Post by mandar84 »

As an alternative, try using $APT_STRING_PADCHAR enviroment variable in you Job Parameter list and set it to 0x20(space)
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

mandar84 wrote:As an alternative, try using $APT_STRING_PADCHAR enviroment variable in you Job Parameter list and set it to 0x20(space)
This is Server architecture and not PX. So no APT variables.
gaya3
Participant
Posts: 42
Joined: Wed Jun 08, 2005 12:34 am

Post by gaya3 »

Hi all,

I have decided to invoke a script as suggested by DSDexter in the After Job Subroutine to remove the characters for now.

Thanks everyone!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In your routine simply

Code: Select all

Convert CtrlM To "" In Line
where CtrlM = Char(13)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So do I take it that, when you write out sequential file records with those routines, they give you DOS delimiters even on a UNIX system unless you 'convert' them with the syntax you posted?
-craig

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