CRLF at the end of a record

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
gpbarsky
Participant
Posts: 160
Joined: Tue May 06, 2003 8:20 pm
Location: Argentina

CRLF at the end of a record

Post by gpbarsky »

[:)][:)][:)][:)][:)]
Hi, my friends.

Here the problem is that, within a BASIC code, I am generating a seq. file using WriteSeq sentence. At the end of the line, a CRLF character is written. Then, when I send the file to Unix this last character is not confortable for my user.[:(]

Does anybody know how can I avoid the writing of this last CRLF character when using WriteSeq from within a BASIC code ?

I'll appreciate any help on this, because for my user it is very important to have this working without problems, and this character is a problem.

Thanks in advance.
[:)][:)][:)][:)][:)]


Guillermo P. Barsky
Buenos Aires - Argentina
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's simply not possible with WriteSeq, since this statement "writes a line to the operating system file". A line ends with the appropriate end-of-line character for that operating system.

What you can do is append the LF character yourself to the line of data you wish to write, and use the WriteBlk statement to write it. You can find this statement in the BASIC manual. WriteBlk writes a block of bytes to the file and does not automatically append an end-of-line character.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The question needs to be asked - how are you sending this file to Unix? There are ways to automate the translation of the record seperators between DOS and Unix.

For example, if you use FTP - a 'Binary' transfer will retain that uncomfortable feeling your user has. However, an 'Ascii' transfer will automagically convert it to the Unix style you need in the process.

Also there is (usually) a shell script called 'dos2unix' that will strip those troublesome ^M characters from the end of each line.

-craig
Post Reply