Unix- Dos Style Issue

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
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Unix- Dos Style Issue

Post by Amit_111 »

Hi all,

I am facing an issue with the line termination. I have some Jobs which I first tested them on windows environment where I used the line termination as "DOS style". Here all Jobs executed successfully.
But when I executed the same jobs on UNIX DS server it gave me warning saying "read_fixedwidth() - row 1, too many columns in record". Here when I changed it to UNIX style, it worked and the Job finished without warnings.
Now what is happening is that on UNIX DS Server, some of my jobs are executing successfully with Line termination as UNIX style and some are getiing executed with Line termination as DOS Style.
I do not want this to happen. I want all the source files(used in diffeent jobs) to use the same kind of Line termination and get successfully executed because the O/P files generated by these jobs are used by a common job and I cannot keep changing the Line Termination according to the different source files used in that common job.
I went through the search but couldnt find the solution.
Please can anyone explain as to why is this happening? and what should be done to successfully handle this issue?

Thanks in Advance.
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

DOS-Line-Termination is CR and LF (CR=Cursor Return CHAR(13), LF=Line Feed CHAR(10).
UNIX-Line-Termination is only LF

Important is to write and read with the same kind of termination. If you mix them up you get an error. (to much colums).

You can use both kinds of termination in both worlds without problems (if staying in DataStage) but you should use the adequate termination in each world for to use the other local tools to read and write without problems.
Wolfgang Hürter
Amsterdam
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Post by Amit_111 »

How to find out whether a particular source file should be given a DOS Style or a UNIX style??
We asked our client but he is also not aware of what kind of Line termination is used.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Change all the files to OS your sitting on. If it is UNIX then make sure all the files are UNIX format. You can find a bunch of commands to do this. tr, dos2unix, sed etc to name a few. You can search for exact syntax on google.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

CR is carriage return or Cursor Return :(


WoMaWil wrote:DOS-Line-Termination is CR and LF (CR=Cursor Return CHAR(13), LF=Line Feed CHAR(10).
UNIX-Line-Termination is only LF

Important is to write and read with the same kind of termination. If you mix them up you get an error. (to much colums).

You can use both kinds of termination in both worlds without problems (if staying in DataStage) but you should use the adequate termination in each world for to use the other local tools to read and write without problems.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Half glass empty, half glass full. :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Just use the type that is appropriate for the file. I don't seen the need to convert everything one way or the other, per se. And it's easy to check.

Open the file in vi. Look at the end of each record. Does it have a "^M" at the end? Yes = DOS file, no = UNIX file. Easy Peasy. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use dos2unix from a before-stage or before-job subroutine (ExecSH). If the file was DOS-style it's now UNIX-style. If it was already UNIX-style, it remains so.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Amit_111
Participant
Posts: 134
Joined: Sat Mar 24, 2007 11:37 am

Post by Amit_111 »

Thanks Guys the command dos2unix worked :D
Post Reply