Although use of ENCODE() will allow you to store the photos in directory files (type 1 / 19), you won't be able to access them from outside in a sensible way, for example using an image viewing program.

The reason to use ENCODE() is that reading and writing directory file records alters the data. On writing, field marks are replaced by newlines and on reading the reverse transformation takes place. This is fine for records that contain text data but is a disaster for binary data such as bit mapped images as there will be bytes in the original data that look like field marks as well as bytes that look like newlines. A quick read/write pair and they are now all the same.

This was a well known problem long ago in UV. There was, for example, a user who decided that instead of recompiling his application on the live system he would simply use COPY to transfer the object code from the test server. The transformation described above neatly destroyed the programs.

There was a similar problem in RESIZE where converting a file from type 1 to type 19 would destroy it. I have encountered several users who have done this with the GLOBAL.CATDIR directory having decided that type 19 seemed more reasonable. Next step - reinstall UniVerse.

Both of these were fixed some time ago but, as far as I am aware, the solution to this rather serious problem is not published. It can be found by examination of the source code of the COPY command (COPY.B in the BP file of the UV account) and is another of the mysterious SYSTEM() values.

After opening the file, do
  ASSIGN 1 TO SYSTEM(1017)
and all reads/writes from directory files will omit the transformation of field marks / newlines. Don't forget to set it back to zero again as it affects all files rather than being attached to just specific files.


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB
+44-(0)1604-709200 -------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to