· Aug 10, 2022

UNicode and 8-bit databases

Is anyone aware of how to find out if a UNICODE database has been installed on an 8-bit version of IRIS i.e. is there a way of checking and actual database rather than the IRIS instance version?

Product version: IRIS 2022.1
Discussion (4)3
Log in or sign up to continue

There isn't any flag telling whether a database is Unicode or not inside the database file. If a Unicode database has no UNICODE characters, it will be accessible by an 8-bit version without problems. 

If you want to know if a database has wide characters (Unicode chars), you could try to read all the globals inside an 8-bits instance and wait for a <WIDE CHAR> error. In order to read all the globals, there are several alternatives, like building a small routine, doing a backup and/or restore, exporting/importing globals, etc. Of course, there are more elegant ways to check the globals and data than expecting an error. 

I am a little surprised you asked this :-P ..... and the answer, as you can imagine, is using the magical $Z functions! 

In this case, searching a little you can find: 

$ZISWIDE (ObjectScript)

Checks whether a string contains any 16-bit wide characters. 


I think playing with other functions could give you what we are looking for here.

Therefore, now that we have a utility that can check if something is Unicode or not, the rest would be to do a routine to read all the globals and check for the content with this function. I have seen routines getting all the globals and looping before but don't have it handy.

This programmatic way of looping and checking all the globals gives you more control and allows you to find where there is something not expected. But, as it takes some time to write if the original question is something you just want to do once, a backup + restore seems quicker and simpler.