DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message
kashif007



Group memberships:
Premium Members

Joined: 07 Jun 2006
Posts: 216
Location: teaneck
Points: 1936

Post Posted: Tue Apr 26, 2011 11:00 am Reply with quote    Back to top    

DataStage® Release: 8x
Job Type: Parallel
OS: Unix
Hello All

I am producing a fixed width file with a carriage return in the last column of each record in the file. The business wants carriage return on all other records except the last record. Can anyway suggest me how can I remove the carriage return at the EOF. If possible, I don't want to remove the carriage return but replace the last carriage return with a space. That way I maintain the fixed length of the record intact.

Thanks

_________________
Regards
Kashif Khan
zulfi123786



Group memberships:
Premium Members

Joined: 04 Nov 2008
Posts: 695
Location: Bangalore
Points: 5724

Post Posted: Tue Apr 26, 2011 11:25 am Reply with quote    Back to top    

check the record delimiter string option of seq file stage it that helps.
Rate this response:  
Not yet rated
kashif007



Group memberships:
Premium Members

Joined: 07 Jun 2006
Posts: 216
Location: teaneck
Points: 1936

Post Posted: Tue Apr 26, 2011 11:59 am Reply with quote    Back to top    

I have already tried various Sequential file options but it did not help. I am looking for a UNIX command to fix this issue.

Following is the scenario. I have a file called "file1" which has the following content.

abc
xyz
123
etc
etc
etc
<-------------------- Blank line to remove

How do I get ride of this blank line at the end. I have already tried the following SED command

sed "$d" file1 > file2

but the carriage return does not go away.

_________________
Regards
Kashif Khan
Rate this response:  
Not yet rated
paultechm
Participant



Joined: 25 Jul 2007
Posts: 27

Points: 172

Post Posted: Tue Apr 26, 2011 1:01 pm Reply with quote    Back to top    

Hi,
Read the file as a single varchar column(without data length) , remove the blank line based on the length.Use column export to split the records into multiple columns

-Paul
Rate this response:  
Not yet rated
kashif007



Group memberships:
Premium Members

Joined: 07 Jun 2006
Posts: 216
Location: teaneck
Points: 1936

Post Posted: Tue Apr 26, 2011 3:03 pm Reply with quote    Back to top    

Issue resolved using a server job, reading the same file with issue from a sequential file stage and writing to a sequential file stage.

Always have the “Omit last new-line” property checked to get rid of the phantom new line on the file.

Thanks everyone

_________________
Regards
Kashif Khan
Rate this response:  
zulfi123786



Group memberships:
Premium Members

Joined: 04 Nov 2008
Posts: 695
Location: Bangalore
Points: 5724

Post Posted: Wed Apr 27, 2011 12:23 am Reply with quote    Back to top    

kashif007 wrote:
I have already tried various Sequential file options but it did not help. I am looking for a UNIX command to fix this issue.


If it is unix that you want to work with, the below should help you.

sed '$d' xyz.dat>tmp.dat
tail -1 xyz.dat|tr -d \n>>tmp.dat
mv tmp.dat xyz.dat
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours