Supress extra Carriage returns

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

ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The error cannot, as Ray has already stated, be caused in that line. Unless you are using one of the two argument variables as parameters to some routine which returns them as a file pointer or a subroutine indirection variable. Are you 100% certain that your source and object are in Sync?
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post by Krazykoolrohit »

Hey try this code to eliminate the CR characters

Trim(Ereplace(input.Link, Char(13): Char(10) ,"",-1,0))

and change your delimiter to a value that is not expected in your input file stream. the windows character map can be of your help. Its in programs -> Accesories -> system tools. choose something thats nevere gonna come in your input stream.

Guru,
Please point out isssues with my approach if any. I have used this approach in my job.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Krazykoolrohit wrote:

Trim(Ereplace(input.Link, Char(13): Char(10) ,"",-1,0))
The problem with this derivation is it removes all the CRLF characters in a string. Which inturn, converts any string with 2 or more lines into a single line which I don't want to happen. I only want to trim those extra CRLF's at the end of the string. Ken's solution worked beautifully. I have already tested it. I was just wondering why Ray's solution didn't work and looking into it.
Kris

Where's the "Any" key?-Homer Simpson
NBALA
Participant
Posts: 48
Joined: Tue Jul 11, 2006 11:52 am
Location: IL, USA

Post by NBALA »

Hi Krish,

Seems you are retrieve from SQL server and the output data is stored in sequential ie flat file and you are tranfering (via FTP?) to the unix server.

When tranfering (FTP?) set the transfer mode as ASCII, then you won't get the <CR><LF> character.( You can view this by opening the file using vi editor , at the end of each line ^M will be there if the file is transfered using Binary mode).

Hope this may help.

Regards
-NB
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

I am on Windows :wink:

And I am loading the data into an Oracle table. Not FTP'ing.
Kris

Where's the "Any" key?-Homer Simpson
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Folks, the issue is that a text block contains trailing CR/LF that the poster wishs "trimmed". It has nothing to do with anything other than prettying up a column.

As a piece of etiquette, it probably behooves anyone responding to a poster to read every reply, not just the last one. Then, replies will not side-track the discussion. This entire post is a lesson on how not reading the original problem can generate a lot of replies that muddy the waters.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

I totally agree with Ken. :)
Kris

Where's the "Any" key?-Homer Simpson
Post Reply