Remove Carriage Return

Friends,

A weird request. ASCII file created by using
put data at 1 Format "x(80)".
put data2 at 1 Format "x(80)".

Where data & data2 has data assigned to it.
This used to be input for Bank system. Now the bank system is upgraded its rejecting this file as there are carriage return in it. How can I create the file without carriage return?

TIA.
 

TomBascom

Curmudgeon
You are putting both data and data2 at column 1. To do that you need to have 2 lines. If you really mean that data2 should simply follow data eliminate the "at 1" from both PUT statements or change data2 to be "at 81".
 

LarryD

Active Member
Are you on a windows system and the bank doesn't want CR's? No matter how you look at it, putting 2 lines at column 1 means there is something (a <lf> instead of <cr><lf> perhaps?) that does this for output. A little more info as to what the bank's requirements are might help.
 

RealHeavyDude

Well-Known Member
Do you create the file on a Windows OS and does the bank read the file on a *nix box?

If that's the case than it might be that line breaks are handled differently on Windows and *nix OS. If I remember correctly, on Windows there are two characters causing the line break, it is <line-feed> CHR(10) and <carriage return> CHR(13) whereas *nix only uses line feed CHR(10). That's the reason that you don't see the line breaks when you open a text file that was created on *nix with the Windows notepad editor and the same text file created on Windows looks screwed up in the vi editor on *nix.

There is a *nix dos2unix command available in almost all flavors of *nix that I know that solves the problem - it stripps off the unwanted carriage return.

But, if that's not an option for you and you want to put the data in different lines so that they are treated correctly on *nix then the following will do:

PUT data1 FORMAT "x(80)". PUT UNFORMATTED CHR(10).
PUT data2 FORMAT "x(80)". PUT UNFORMATTED CHR(10).

HTH, RealHeavyDude.
 
Thanks for the response will apply the Real heavy dude soln.

The program runs on Linux but creates file Linux-Win share drive.
 

RealHeavyDude

Well-Known Member
You're welcome.

I guess, then it was just the other way round. The bank program expecting the Windows line break whereas the file contains the *nix line break.


Regards, RealHeavyDude.
 
More Revelations; unix2dos doesnt operate within PROGRESS, however this did the trick.

os-command awk 'sub("$", "\r")' BANKFL.EMT > BANKFL.EMT.
 

StuartT

Member
More Revelations; unix2dos doesnt operate within PROGRESS, however this did the trick.

os-command awk 'sub("$", "\r")' BANKFL.EMT > BANKFL.EMT.

I have difinitely used unix2dos from within an os-command in the past, cant try it out now as I dont have a unix environment
 
Top