+ Reply to Thread
Results 1 to 11 of 11

Thread: Remove Carriage Return

  1. #1
    Join Date
    Jul 2008
    Location
    Cork/Mumbai
    Age
    33
    Posts
    572
    Rep Power
    45

    Default 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.

  2. #2
    Join Date
    May 2005
    Location
    Greenfield, New Hampshire
    Posts
    2,256
    Rep Power
    168

    Default Re: Remove Carriage Return

    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".
    --
    Simplifying the job of Managing and Monitoring The World’s Best Business Applications.
    http://www.dbappraise.com
    http://www.wss.com

  3. #3
    Join Date
    Jul 2008
    Location
    Cork/Mumbai
    Age
    33
    Posts
    572
    Rep Power
    45

    Default Re: Remove Carriage Return

    Tom,

    Was awaiting your reply, thanks.
    However data 2 must start at 1, hence the stone wall.

  4. #4
    Join Date
    Aug 2006
    Posts
    148
    Rep Power
    22

    Default Re: Remove Carriage Return

    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.

  5. #5
    Join Date
    Oct 2009
    Location
    Zuerich
    Posts
    463
    Rep Power
    34

    Default Re: Remove Carriage Return

    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.

  6. #6
    Join Date
    Jul 2008
    Location
    Cork/Mumbai
    Age
    33
    Posts
    572
    Rep Power
    45

    Default Re: Remove Carriage Return

    Thanks for the response will apply the Real heavy dude soln.

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

  7. #7
    Join Date
    Jul 2008
    Location
    Cork/Mumbai
    Age
    33
    Posts
    572
    Rep Power
    45

    Default Re: Remove Carriage Return

    Bad Luck. See attached.
    Attached Files
    • File Type: txt xx.txt (162 Bytes, 16 views)

  8. #8
    Join Date
    Jul 2008
    Location
    Cork/Mumbai
    Age
    33
    Posts
    572
    Rep Power
    45

    Default Re: Remove Carriage Return

    Lads,

    UNIX2DOS did the trick RHD..thanks mate.

  9. #9
    Join Date
    Oct 2009
    Location
    Zuerich
    Posts
    463
    Rep Power
    34

    Default Re: Remove Carriage Return

    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.

  10. #10
    Join Date
    Jul 2008
    Location
    Cork/Mumbai
    Age
    33
    Posts
    572
    Rep Power
    45

    Default Re: Remove Carriage Return

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

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

  11. #11
    Join Date
    Jul 2009
    Posts
    91
    Rep Power
    10

    Default Re: Remove Carriage Return

    Quote Originally Posted by Kishor Chari View Post
    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

+ Reply to Thread

Similar Threads

  1. Carriage return in code
    By nickree in forum Development
    Replies: 6
    Last Post: 7 Jul 2009, 09:52 AM
  2. Carriage Return Line Feed
    By brianp in forum Development
    Replies: 11
    Last Post: 16 Jun 2009, 10:35 AM
  3. Carriage return in a blob-field
    By elmasacretum in forum Development
    Replies: 12
    Last Post: 29 Apr 2005, 04:51 AM
  4. Carriage Return/LF
    By kevino in forum Development
    Replies: 2
    Last Post: 27 May 2004, 06:43 PM
  5. Carriage Return and Line Feed
    By djeanveau in forum Development
    Replies: 3
    Last Post: 27 Nov 2003, 10:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts