Some time ago I got a WRC case transferred where a customer asks for the availability of a raw DEFLATE compression/decompression function built-in Caché.

When we talk about DEFLATE we need to talk about Zlib as well, since Zlib is the de-facto standard free compression/decompression library developed in the mid-90s.

Zlib works on particular DEFLATE compression/decompression algorithm and the idea of encapsulation within a wrapper (gzip, zlib, etc.).
https://en.wikipedia.org/wiki/Zlib

9 6
1 2.5K
Article
· Jun 12, 2017 1m read
Setting the Windows service account

I recently helped a site investigate a problem that appeared after they upgraded their Windows instance of Caché from 2015.1 to 2017.1. A terminal session launched from the server's desktop cube was unable to run OS-level commands using the $ZF(-1) function. For instance, using the no-op command "REM" as follows:

write $zf(-1,"rem")

was returning -1, indicating that the Windows command could not be issued.

8 6
1 1.5K
This is the second part of my long post about package managers in operating systems and language distributions. Now, hopefully, we have managed to convince you that convenient package manager and rich 3rd party code repository is one key factor in establishing of a vibrant and fast growing ecosystem. (Another possible reason for ecosystem success is the consistent language design, but it will be topic for another day.)
6 23
1 1.3K

Our company is in the process of converting our software for use in Intersystems IRIS and one of the major sections of the software makes use of a custom statically-linked C library using the $ZF("function-name") functionality. During this, I found out that the process for setting up the C library to be used within the database platform has changed significantly between Cache and IRIS.

5 0
0 244

There are numerous ways to interact with InterSystems Caché: We can start with ODBC/JDBC that are available via SQL gateway. There are API for .NET and Java too. But if we need to work with native binary libraries, such interaction is  possible through Caché Callout Gateway, which can be tricky. You can read more about the ways of facilitating the work with native libraries directly from Caché in the article below.

5 1
1 940
Article
· Mar 6, 2016 2m read
Who does Windows think I am?

When my COS code is executing in a Caché process it might want to interact with the host operating system. For the purpose of this post I'm focusing on a Windows host, but much of it applies to other host OS platforms as well.

A common example of host OS interaction is when my process wants to read from or write to a file. What credentials will apply when Windows is checking whether or not to allow me access to the file?

To answer that we need to consider another question. How did our process start?

3 6
0 952
Question
· Mar 17, 2020
Building $lb from C

I have a C string and I need to build a $lb from it.

This code works fine for strings shorter than 254 characters:

char *str = "some string";
int len = strlen(str);
int add = 2;
char *list = malloc(len + add + 1);
char lenChar = len + add;
sprintf(list, "%c\x01%s", lenChar, str);

Thought maybe someone can share the code for longer strings?

0 1
1 266

I am working on a BPL to take data from a MS SQL database and create an HL7 Materials Message for our EMR. I have done this plenty of times in the past however I am running into an error.

"Remote Gateway Error: JDBC Gateway SP execute(0) error 0: Access to the remote server is denied because no login-mapping exists."

What is confusing is that this BPL doesn't differ from any of my other BPLs in connecting to MS SQL Server. I know I am missing something..

0 3
0 583

Hi,

Is there any way to set environment variables in Linux from Cache?

I see a way to get an environment variable with: $system.Util.GetEnviron()

Essentially I am converting from VMS (DCL) to Linux.

In VMS we used $ZF(-1,"SETSYM") in Cache to a value and then interpreted that value in a DCL procedure.

0 2
0 703
Question
· Mar 20, 2019
Query Response from MSSQL

I am having an intermittent issue that when I make a call to MSSQL from a BPL that the response does not come back in the amount of time required. Since the call from the BPL is synchronous I tried changing the timeout to 60 but it has not helped (see below). Is there anyway to guarantee that the call waits long enough for a response before continuing on?

Thanks

0 4
0 336

I have a simple callout library:

#define ZF_DLL
#include 
#include 
#undef ERROR

int GetRandom(double* random) {
   // Py_Initialize();
   // Py_Finalize();
   *random = 1.0;
   return ZF_SUCCESS;
}

int main(int argc, char **argv)
{
   printf("Random: ");
   double random=0;
   GetRandom(&random);
   printf("%lf", random);
   return 0;
}

ZFBEGIN
    ZFENTRY("GetRandom","D",GetRandom)
ZFEND

I compile this code as a shared library and it works fine with:

0 4
0 465
Question
· May 6, 2016
Load a dll at run time

I am using java gateway imported/proxy classes and JG business service. I need to load a dll at run time.

I use System.loadLibrary/System.load when in java. I’ve tried $ZF(-3,” C:\Windows\System32\pteidlibj.dll”) and $ZF(-4,1,"C:\Windows\System32\pteidlibj.dll") but I’m getting <DYNAMIC LIBRARY LOAD> error.

How can I load a dll at run time using COS?

0 5
0 1.1K

I use zf(-2) to spawn a external a Java application in a *nix instance.

I would like to kill this process after some conditions met.

I would like to leverage $zf("kill ... ") but this requires its the pid of this child process.

So is there a way to acquire the pid for the child process when I create it ?

If not, how is the suggested way to kill this process?

Thanks.

0 1
0 321

Hi I've created a word macro in order to convert doc to txt via the command line, this works fine via the command line by myself or another user but when I try as an the intersystems user which runs under LocalSystem it doesn't work.

So can I change the user, or set the $ZF to run as a different user?

Or do I have to try another way to convert doc to txt - it's looking like libreOffice?

I just wanted to stick with word because I could be guaranteed on the result being accurate.

Thanks

Regards

Richard

0 11
0 1.1K

Hi guys,

I am trying to run a command line code using $zf(-1) in cache terminal. it is returning access denied error.

I have tried to run the code in cmd itself it is also throwing Access denied error. But if opened cmd as administrator and run the same code it is working perfectly. I am using windows system.

Hence i need to know how can i run the cmd line code as administrator using our terminal or studio. Please help me out.

Thanks,

Mani

0 4
0 2K

Hello everybody,

We have a piece of Caché software which calls an external utility using $zf(-1,command). It works fine under Linux, but under Windows an external process occasionally hangs (due to some internal problems out of the scope here) and need to be killed programmatically. Having PID, it's easy to kill a process. If a Caché process is called with JOB command, the caller can easily get its PID from $zchild, but alas $zf(-1) does not seem to return the similar info. Is it possible to get it somehow?

0 4
0 603

I have done Python - Cache binding setup following the guide from http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=.... I have also run test.py from sample3 folder and it able to run and complete successfully.

However, when I try to run the same test.py code via $zf, it gives error with exit code 1.

I've tried running help("intersys.pythonbind3") via $zf and also running from Cache terminal as follows:

0 6
0 672

Per the information at http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=... I am trying to use a call to $ZF("GETFILE") to obtain information about an OpenVMS file. But I get an <ILLEGAL VALUE> error.

For example:

w $zf("GETFILE",filename,"UIC")

reports:

<ILLEGAL VALUE>

My filename variable contains the full path and name of a file that I own. I hold the %All role in Cache.

0 4
0 455