Antonio Garcia ... · Jul 25, 2018

EnsLib.HL7.Operation.FileOperation - Line Feed


I am using a standard EnsLib.HL7.Operation.FileOperation to create files based on HL7 messages but I just realised that lines in the output file only contain CR (Character Return) but no LF (Line Feed). It is really important to have both as another system picking those files will fail otherwise...

Is there any way to configure this?


1 662
Discussion (4)2
Log in or sign up to continue

Apparently this is exactly what I am looking for: intersystems help but the problem is that I would prefer to use the standard file operation rather than create a new custom one.

Writes a string to the file and appends to the string the characters specified in the LineTerminator property. By default, the LineTerminator is a carriage return followed by a line feed (ASCII 13, ASCII 10).

If your operating system requires a different value for the LineTerminator property, set the value in the OnInit() method of the business operation. For example:

 Method OnInit() As %Status
      Set ..Adapter.LineTerminator="$C(10)"
      Quit $$$OK

You can also make the property value to be dependent on the operating system:

 Set ..Adapter.LineTerminator="$Select($$$isUNIX:$C(10),1:$C(13,10))"

Have a look at the separators and framing settings in EnsLib.HL7.Operation.FileOperation. The sixth item in Separators is the segment terminator (carriage return in standard HL7) while Framing lets you change the message terminator (line feed in standard HL7). You can change these to non-standard values if needed.

From the separators documentation linked above:

 HL7 separator characters to use in the outgoing message. If you leave this field blank, the default is:
 An HL7 message uses special characters to organize its raw contents. These characters may vary from one clinical application to another. For this reason, the HL7 standard requires that each HL7 message list the five specific characters that it is using as separators at the start of the MSH segment, in order from left to right:
  1.  Field separator (FS)
  2.  Component separator (CS)
  3.  Repetition separator (RS)
  4.  Escape character (ESC)
  5.  Subcomponent separator (SS)
A sixth character, the segment terminator character, is not specified in MSH and is generally assumed to be a carriage return (ASCII 13).
 For Separators, you must supply a string of characters which Ensemble assigns to HL7 separators in left to right order: FS, CS, RS, ESC, SS as described in the previous list.
 Beyond positions 1 through 5 of the Separators string, you can supply additional characters to override the default segment terminator character, the carriage return (ASCII 13). After position 5, use \r for the carriage return (ASCII 13) and \n for the line feed (ASCII 10).
 You can use \x in positions 1 through 5 if you need to specify segment terminators in positions 6 and higher but want your output messages to use fewer than 5 separators. Separators designated by \x in positions 1 through 5 are not used. The purpose of \x is simply to extend the length of the list of separators so that position 6 is interpreted correctly as the first segment terminator.