Enrico Parisi · Apr 19, 2024 go to post

Here is a sample method to deflate without using file I/O and using XDEV instead.

ClassMethod UnDeflate(Compressed As %String, Output UnDeflated As %String) As %Status
{
    Set sc=$$$OK
    Try {
        ; open XDEV device
        Set dev="|XDEV|"_+$JOB
        Open dev:($ZF(-6,$$$XSLTLibrary,12):/HOSTNAME="XSLT") Use dev
        ; write compressed string
        Write Compressed
        ; flush buffers
        Write *-3
        ; change device mode to deflate and rewind
        Use dev:(:/COMPRESS="DEFLATE":/POSITION=0)
        ; read uncompressed content
        Read UnDeflated
    } Catch CatchError {
        #dim CatchError as %Exception.SystemException
        Set sc=CatchError.AsStatus()
    }
    Close dev
    Quit sc
}

I really wish that InterSystems implement the various compress/deflate/gzip functionality available in device I/O as utility methods. Without silly wrappers! 😉

Another wish, please InterSystems document XDEV device I/O.

Enrico Parisi · Apr 19, 2024 go to post

If I understand correctly you need to deflate and I suppose you want to add the custom wrapper to use $System.Util.Decompress(), if so...you can't. I mean you can't use $System.Util.Decompress() BUT, you can indeed deflate using I/O as in the example I posted in that post/thread.

Enrico Parisi · Apr 19, 2024 go to post

I agree that I don't like #; as a comment BUT, I prefer ; instead, I'm not a fan of // comments, probably because I'm an old InterSystems user.

Fortunately there is a way to change it, thank you for sharing the details.

Enrico Parisi · Apr 18, 2024 go to post

Beware that OnFailureTimeout() does not work as expected as described in this post.

The issue is present up to 2023.3 and is fixed in 2024.1.

Enrico Parisi · Apr 18, 2024 go to post
    Set Found=0
    Set Id=""
    For  {
        Set Id=$order(^DataTest(Id)) Quit:Id=""
        If $listget(^DataTest(Id),2)=1516 {
            Set Found=1
            Quit
        }
    }
    If Found Write "Found 1516 in Id: ",Id,!
Enrico Parisi · Apr 18, 2024 go to post

What problem are you facing configuring system default settings for Ens.Alert component? If should work as any other component.

I suggest to read the relevant documentation for your version:

Defining System Default Settings

and if you find some issue please provide some detail of the specific problem you are facing.

Enrico Parisi · Apr 5, 2024 go to post

Please note that all timestamps (TimeCreted, TimeProcessed) in Ens.MessageHeader use Ens.DataType.UTC datatype. It's UTC time.

So, in what mode is your query running?

GETDATE() : A date/time function that returns the current local date and time.

Enrico Parisi · Apr 3, 2024 go to post

these are system classes that are part of the product that do exists in the new installed version in the %SYS namespace.

If the Studio screenshot you have posted is not from the %SYS namespace (it really does not seems so), then probably the System package is mapped to that namespace, possibly also the related globals. But...I'm guessing here from the little details and context you provide.

Enrico Parisi · Apr 3, 2024 go to post

You had 24 errors during compilation, maybe (probably) one of the 24 is the "missing" class.

Can you try to compile that class individually?

Enrico Parisi · Apr 3, 2024 go to post

If your classes are in deployed mode, then you need the source code that (hopefully) was saved before deploying the classes.

Enrico Parisi · Apr 3, 2024 go to post

If %f is not working in your environment my guess is that, for some reason, the property OriginalFilename is not set in the incoming message to your EnsLib.File.PassthroughOperation Business Operation.

Where is the incoming message coming from? Why the OriginalFilename  is not set?
Can you provide some more details on your environment?

Enrico Parisi · Apr 2, 2024 go to post

Often the if command is used for $increment because that is the "cheapest"/lightest way to increment a (local/global) variable.
In other words, it's a kind of performance optimization when using $increment.

Personally I use all the times I use $increment and I don't need the incremented value back.

Enrico Parisi · Apr 2, 2024 go to post

For your response I assume you are searching for a class used by a Business Host component within a production.

Using IRIS you can search for that, and much more, using "Interface Reference" within the Management portal:

Unfortunately you are using an old version where this feature is not available.

Add this to the (possibly long) list of good reasons to move to IRIS.

Enrico Parisi · Apr 2, 2024 go to post

Once you have configured jdbc or odbc gateway to your sqllite DB, then the easier way is to use data migration wizard, from Magegement Portal:

System Explorer -> SQL, then Wizards -> Data Migration

"The Data Migration Wizard will help you copy SQL table definitions and data by using your defined SQL Gateway connections."

Enrico Parisi · Apr 2, 2024 go to post

For 2 & 3 you setup IRIS to connect to sqlite via jdbc/odbc and then import data and definitions.

Enrico Parisi · Apr 2, 2024 go to post

What kind of class is abc.test.cls?

Is this class inherited by business components? Is it a utility called from business components? A datatype class Other?

Enrico Parisi · Apr 2, 2024 go to post

Three options come to my mind:

1) export to CVS and use IRIS import

2) use sqlite JDBC

3) use sqllite ODBC

Using 2 or 3 you can import data and definitions directly

Enrico Parisi · Apr 2, 2024 go to post

Does git-source-control   works with Caché 2017? The Prerequisites mention only IRIS.

Enrico Parisi · Apr 2, 2024 go to post

Yes, ..%RequestHeader.TimeCreated in BO contains the  exact time (up to the millisecond) when the BO's request message was created.

Enrico Parisi · Apr 1, 2024 go to post

Well...in OnProcessInput method timeProcessed is current date/time!

No message or session has been created yet your (your code will do that).

Enrico Parisi · Apr 1, 2024 go to post

I don't think that long string support is the issue.

Can you provide details on when/where you get the <MAXSTRING> error?

Enrico Parisi · Apr 1, 2024 go to post

Where in a Business Service you need this?

..%RequestHeader is the header of a received request, a BS does not receive a "production request", it SEND a request to other business host (BP or BO).

Enrico Parisi · Apr 1, 2024 go to post

For DEFLATE use:

open tmpFile:("WNS":::/COMPRESS="DEFLATE"):0

	set original = "my very long string which needs to be deflated"
	zwrite original

	write !,"using $system.Util.Compress",!
	set compressed = $system.Util.Compress(original, "zlib")
	set compressed=$e(compressed,4,*-5)
	zwrite compressed
	zzdump compressed write !
	set deflated = $system.Encryption.Base64Encode(compressed, 1)
	zwrite deflated

	set tmpFile = ##class(%File).TempFilename("bin")

	set io = $io
	open tmpFile:("WNS":::/COMPRESS="DEFLATE"):0
	use tmpFile
	write original
	use io
	close tmpFile

	set stream = ##class(%Stream.FileBinary).%New()
	set stream.Filename = tmpFile
	set stream.RemoveOnClose = 1
	set compressed = stream.Read(stream.Size)  

	write !,"using open file",!
	zwrite compressed
	zzdump compressed write !
	set deflated = $system.Encryption.Base64Encode(compressed, 1)
	zwrite deflated

	write !,"Expected",!
	set base64 = "y61UKEstqlTIyc9LVyguKcoEUuUZmckZCnmpqSnFCiX5CkmpCimpaTmJJakpAA=="
	set compressed = $system.Encryption.Base64Decode(base64)
	zwrite compressed
	zzdump compressed write !

Result:

original="my very long string which needs to be deflated"
 
using $system.Util.Compress
compressed="Ë­T(K-ªTÈÉÏKW(.)Ê"_$c(4)_"Rå"_$c(25,153)_"É"_$c(25,10)_"y©©)Å"_$c(10)_"%ù"_$c(10)_"I©"_$c(10)_")©i9"_$c(137)_"%©)"_$c(0)
 
0000: CB AD 54 28 4B 2D AA 54 C8 C9 CF 4B 57 28 2E 29         Ë­T(K-ªTÈÉÏKW(.)
0010: CA 04 52 E5 19 99 C9 19 0A 79 A9 A9 29 C5 0A 25         Ê.Rå..É..y©©)Å.%
0020: F9 0A 49 A9 0A 29 A9 69 39 89 25 A9 29 00               ù.I©.)©i9.%©).
deflated="y61UKEstqlTIyc9LVyguKcoEUuUZmckZCnmpqSnFCiX5CkmpCimpaTmJJakpAA=="
 
using open file
compressed="Ë­T(K-ªTÈÉÏKW(.)Ê"_$c(4)_"Rå"_$c(25,153)_"É"_$c(25,10)_"y©©)Å"_$c(10)_"%ù"_$c(10)_"I©"_$c(10)_")©i9"_$c(137)_"%©)"_$c(0)
 
0000: CB AD 54 28 4B 2D AA 54 C8 C9 CF 4B 57 28 2E 29         Ë­T(K-ªTÈÉÏKW(.)
0010: CA 04 52 E5 19 99 C9 19 0A 79 A9 A9 29 C5 0A 25         Ê.Rå..É..y©©)Å.%
0020: F9 0A 49 A9 0A 29 A9 69 39 89 25 A9 29 00               ù.I©.)©i9.%©).
deflated="y61UKEstqlTIyc9LVyguKcoEUuUZmckZCnmpqSnFCiX5CkmpCimpaTmJJakpAA=="
 
Expected
compressed="Ë­T(K-ªTÈÉÏKW(.)Ê"_$c(4)_"Rå"_$c(25,153)_"É"_$c(25,10)_"y©©)Å"_$c(10)_"%ù"_$c(10)_"I©"_$c(10)_")©i9"_$c(137)_"%©)"_$c(0)
 
0000: CB AD 54 28 4B 2D AA 54 C8 C9 CF 4B 57 28 2E 29         Ë­T(K-ªTÈÉÏKW(.)
0010: CA 04 52 E5 19 99 C9 19 0A 79 A9 A9 29 C5 0A 25         Ê.Rå..É..y©©)Å.%
0020: F9 0A 49 A9 0A 29 A9 69 39 89 25 A9 29 00               ù.I©.)©i9.%©).
 
Enrico Parisi · Mar 31, 2024 go to post

I've been there before on IRIS zlib compression library....

The problem is explained in Compress(), from Class Reference %SYSTEM.Util, Compress() method (emphasis mine):

Returns the compressed form of a given string.
When Type is specified, it is the compress algorithm used to compress the data. Its value can be "zlib", "zstd" or "lz4". If Type is not specified then the "zlib" compression algorithm is used. A compressed string is a compressed data block with a customized wrapper. Use Decompress() to decompress it.

So, after Compress() you need to remove the "customized wrapper":

set compressed=$e(compressed,4,*-5)

Unfortunately Decompress() needs the custom wrapper, and I don't know how to make it up, however, as in your sample, I/O can be used, using file in your sample.

Regarding the file I/O, note that form Open command documentation:

"zlib" — Use the zlib compression library. /COMPRESS="zlib" is equivalent to /GZIP=1

So, if you change:

open tmpFile:("WNS":::/COMPRESS="zlib":/GZIP=0):0

With:

open tmpFile:("WNS":::/GZIP=0):0

It will then work just fine.

I fully agree that it's a pity to have zilib compress/uncompress utility "custimized" with proprietary wrapper that makes it unusable for any "standard use". However in that case you can use I/O, file or other devices. Personally I use XDEV for compress/decompress and leave the silly %SYSTEM.Util.Compress()/Decompress() alone.

Enrico Parisi · Mar 29, 2024 go to post

First I'd suggest to test the DSN from linux, assumung you are using unixODBC ODBC driver manager:

isql -v HL7Interface2 myusername mypassword