Test files corrupting due to 7edit?

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Test files corrupting due to 7edit?

  • Creator
    Topic
  • #51488
    Mike Klemens
    Participant

    I am a newbie to cloverleaf so go easy on me!  😕

    We run cloverleaf on an HP UX setup and sometimes FTP files back and forth from our windows machines.  Usually we edit these files using something like UltraEdit but have recently tried using a program called 7edit to modify test messages a bit easier.  However, if I modify a message in 7edit and then send it back to our Unix server and run it through the HL7 testing tool, it works but I see the following error:

    ERROR: found some data without a newline, treating as a message anyway

    Anyone ever run into this before? Any ideas how to fix it?

    Thanks so much!

    -Mike

Viewing 7 reply threads
  • Author
    Replies
    • #70493
      Jim Kosloskey
      Participant

      Check to see if your editor is saving the data as a unix or windows file – that might cause an issue.

      Welcome to Cloverleaf(R) and the clovertech forum.

      You won’t be sorry you are working with Cloverleaf(R) or that you engaged this forum.

      email: jim.kosloskey@jim-kosloskey.com

    • #70494
      Mike Klemens
      Participant

      Maybe this is a silly question but do you know what the default encoding is on a unix system – is it UTF-8?

      The default encoding on the 7edit application is:

      windows-1252 (Windows Latin-1)

      It will let me change it to a lot of other standards (US-ASCII, ISO, UTF, etc..) but I am not sure which one is best for unix…

    • #70495
      Jim Kosloskey
      Participant

      I don’t think it is the encoding that is the issue (it might be) but rather the use of Carriage Returns and Line feeds by Windoze at the end of each line versus UNIX just using one of those (I walways have to look up which one UNIX uses).

      In UltraEdit (which I use here), you can specify to save the file as a UNIX file.

      email: jim.kosloskey@jim-kosloskey.com

    • #70496
      Sundeep Kumar
      Participant

      If you take a msg file that is X0D terminated at segment  ends and x0D x0A terminted at EOF and edit it in 7Edit it preserves X0D terminated at segment  ends but removes the trailing x0A and EOF. after you edit in 7Edit open the file in a HEX editor like XVI32 and insert a x0A at the end of file an dit will work.

    • #70497
      Mike Klemens
      Participant

      Thanks for the advice Jim and Sundeep – anyone think there is an easy way to automate this process (of using a hex editor to “fix” the file) – perhaps either a windows script or a unix shell script?

    • #70498
      Bob Richardson
      Participant

      Greetings,

      For CIS5.6 and above, I have noticed for protocol “fileset/local” for both Inbound and Outbound configuration specifications, there is a CRNL convert option with a drop down list for “CRNL convert” that appears to allow for conversion from Unix style to Windows and vice versa.

      Maybe can experiment with it and set up an interface to auto convert the messages?

      Just a suggestion as I haven’t played around with it myself.

      Enjoy.

    • #70499
      Chris Williams
      Participant

      If you are FTPing between Windows and Unix, it’s the line terminations that will get you. Native line terminations are:

      Unix: x0a (LF, linefeed, newline, ^J)

      Windows:  x0dx0a (CRLF, carriage return/linefeed, ^M^J)

      Mac: x0d (CR, carriage return, ^M)

      HL7 messages are really native to UNIX in that, unlike Windows/DOS and Mac, they use the x0d and x0a for different purposes. x0d is the segment terminator, x0a is the message terminator. In UNIX, an HL7 message is equivalent to a single line. You can display the count of messages in a file by using the UNIX command “wc -l fileName”

      We use a tcl proc to handle the conversion/cleanup on files moved from Windows to UNIX. We move them as binary files. You can write your proc in a number of ways, but these steps are what you want to accomplish:

      1. Convert anyx0dx0a pairs to x0d by deleting all xa occurrences. You’re file is now comparable to a SMAT .msg file.

      2. Convert any x0dx0d strings to a single x0d so you don’t create empty segments.

      3. Convert any string of x0dMSH to x0dx0aMSH. This will put in all the correct message terminators except for the last message which will be terminated correctly by closing the file you are writing in your tcl proc.

      Don’t punish yourself by trying to use an editor to fix the messages by hand.

    • #70500
      Russ Ross
      Participant

      Here are a couple of scripts I use to convert DOS files to Unix files and vice versa:

      dos_to_unix.ksh

      Code:

      #!/usr/bin/ksh

      perl -pi -e ‘s/rn/n/g’ $1

      unix_to_dos.ksh

      Code:

      #!/usr/bin/ksh

      perl -pi -e ‘s/n/rn/g’ $1

      I also find the cloverleaf backend command ( hcihd ) usefull to determine what are the line termination characters so I can see exactly how the file is foo-barred.

      Russ Ross
      RussRoss318@gmail.com

Viewing 7 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
4,964
Forums
28
Topics
9,104
Replies
33,616
Topic Tags
248