Question
· Mar 27, 2023

Caché-Error: <MAXSTRING>zgetAtFromArray+46^EnsLib.HL7.Segment.1

Hi,

we get HL7 MDM messages with embedded PDF documents that are Base64 encoded. When the embedded PDF document exceeds the size of 3.6 MB the following error occurs:

FEHLER <Ens>ErrBPTerminated: BP Main HL7 MDM # wird wegen folgenden Fehlers beendet: FEHLER #5002: Caché-Fehler: <MAXSTRING>zgetAtFromArray+46^EnsLib.HL7.Segment.1
> FEHLER #5002: Caché-Fehler: <MAXSTRING>zgetAtFromArray+46^EnsLib.HL7.Segment.1

In other posts I read that you can avoid these errors, if you use the data type %VarString instead of normal %String. Are there prebuilt classes that already use VarStrings or do I have to develop them on my own?

How do you work with large PDF documents in MDM messages? Do you keep them embedded or are you working with references to a file in a shared folder.

Thanks for your help.

Product version: HealthShare 2017.2
$ZV: Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2017.2.2 (Build 865_0_18359U) Wed Jul 25 2018 16:08:01 EDT [HealthShare Modules:Core:15.032.9686 + Linkage Engine:15.032.9686]
Discussion (3)2
Log in or sign up to continue

if you take a look to method ##class(EnsLib.HL7.Segment).getAtFromArray(...)
you see that the segment data is assembled in row 1008 of the class by  Set data=data_value 
without checking the size.
So it is designed to fail with large documents as your Base64 encoded PDF (~+33% of original)
So just using a reference to an external stored file as you suggested should work. 

 

BTW datatype %VarString is just a shortcut of %String(MAXLEN="") and a sometimes appropriate SQLTYPE.
 

There are methods for dealing with what are essentially embedded streams in HL7 Objects. See the methods GetFieldStreamRaw() and StoreFieldStreamRaw() in class EnsLib.HL7.Message; these are useful for copying streams from one message to another. If the need is to extract the Base64 stream as a binary stream for writing to a file, there's also GetFieldStreamBase64() in the same class; the stream obtained from it can be used with file-based streams to write to a disk file.