Saving a message to memory from terminal

Trying to save a message to memory from terminal.   The following is not working as I know I'm missing something.

Set HL7Msg=##class(EnsLib.HL7.Message).Identifier(XXXX)

  • 0
  • 0
  • 134
  • 1
  • 2



• property Identifier as %String [ Calculated,Transient,ReadOnly ];

Unique document identification string found at MSH:10 / MessageControlId in document content

You can't set it. It gets calculated and is ReadOnly.

you should probably start  with

     set Set HL7Msg=##class(EnsLib.HL7.Message).%New()
 and start to compose the message accordingly.

You can do it using below code.

set strADT ="MSH|^~\&|MEDICO|JOE'S HOSPITAL^|OCIEB2B|OCIEUHGB2BTEST|20130730072041|SECURITY|ADT^A01|MSG00001|P|2.7|||AL"_$c(13)
set InputADT=##class(EnsLib.HL7.Message).ImportFromString(strADT)
set InputADT.DocType="2.7:ADT_A01"  

In case you need to import it from a stream you can use ImportFromStream method to import the content from stream.


I was able to find what I needed.   Set MSGX=##Class(EnsLib.HL7.Message).%OpenId(xxxxxxx)   works