Question
· Jun 12, 2023

Throwback code: $zu(0) and $zu(1) (aka, $ZUtil(0) and $ZUtil(1))

This is for the veteran programmers out there (you know who you are; you started programming before date 60000). 

I'm in the middle of updates for our system, and I've come across many $ZU() calls. Most of them are documented in the "Replacement List", but two are missing: $ZUtil(0) and $ZUtil(1).

I honestly don't remember what these are for (and I'm pretty sure I used them in code in a previous century), so if someone can tell me, great.  If you can provide a link to a reference, better!  

As always, I appreciate your help.

Product version: Caché 2016.1
$ZV: Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2016.2.3 (Build 903U) Tue Oct 24 2017 11:33:45 EDT
Discussion (10)4
Log in or sign up to continue

Well...I don't remember using them in either Caché or the previous M/SQL and don't see them documented at all going back to Caché 4.1 (the oldest I can find on InterSystems' site), but a search of current (IRIS 2022) %SYS code suggests $zu(0) is used in database creation (ref in %SYS.DATABASE.int):

CreateDatabase+45    s rc=$zu(0,dir,blksiz,uic,0,expandby,maxfilsiz,$g(gdir,2),$
            g(gpblk),0,0,$g(ggblk),$g(freeze,1),0,$g(clmntmode,0),0,collation)

However I've also seen it like this, not in this system:

S SYS=$P($ZU(0),",",2)

Not so sure about $zu(1) but you can find it in GBLOCKCOPY.int and NLSLOAD.int.  Tried searching comp.lang.mumps?

As I started with MUMPS, $H was a few days ahead of 50000, this means, I wrote my first programm (MUMPS V4b on a DEC PDP-11/34) even before ISC was founded. I have never made a direct use of those functions but, if a recall it right, they are used during the installation process (database creation, etc.) .  A quick look into the oldest docs I have (Cache 2.3) says nothing about those functions.

On Caché and IRiS, both %ZU(0) and $ZU(1) will signal <FUNCTION> because they need more than 1 arugment.

On IRIS, $ZU(0,directoryName,....) with enough additional arguments will create an IRIS.DAT database file. and $ZU(1,...) will modify an existing IRIS.DAT database file.  On Caché these functions create/modify a CACHE.DAT database file.  These are legacy functions.

The Config.Database class provides ways to modify the CPF configuration file to create and configure databases.

Interactively you also use the System Management Portal (SMP) by clicking SystemAdministration > Configuration > SystemConfiguration > LocalDatabase to find the SMP webpage that can create or modify local databases.

Or you can use the DO ^|"%SYS"|DATABASE command line utility as a way to create and configure databases.