I trying to create a list of objects in an IFS directory. This weekly job
will copy all the files to an archive directory and delete the original.
Everything works fine. My problem is I don't understand what
%str(%addr(d_name)) is doing and why it is needed.
Walking through the program in debug, I noticed that d_name has a value. I
changed the code to the "easier on the eyes" version which is simply taking
a 256 char field and truncating it in a 120 char field.
C Eval EntryName = d_name
Unfortunately, everything isn't working now. If the current object name is
smaller (fewer characters) than the previous object's name, the excess
characters are left in d_name and are transferred to EntryName.
For instance, if BIGBIGBIGFILENAME.xls is the first object and
"SMALLNAME.xls" is the next object, the value of d_name will be
"SMALLNAME.xls ME.xls" The last 6 characters of the previous name are
still in the field. In testing I've found that the value of d_name always
contains the actual object name plus two blank characters. If the previous
name was longer than that, it is still visible.
What I don't understand is why doesn't %str(%addr(d_name)) pick up the full
value (i see it in Debug), but a simple assignment does?
I've found a work around to be:
C Eval EntryName = %SubSt(d_name:1:d_namelen)
d_namelen is the actual length of the name field being passed back. So
assuming anything else is trash, it can be ignored. Only this doesn't
answer what %str & %addr is doing.
Thanks for any insights.