The length field in CBL_DIR_SCAN_START is definitely supposed to reflect the actual size of the search string text itself and not the max length of the field. You can set this to any value up to the actual length of the field but that assumes that the pattern string is that size. What you are getting back from the READ call would be categorized as "undefined" behavior and there would be no guarantee that it would continue to return these same values in the future. I would recommend just setting the length to 0 and null terminating the string used. In managed code you could do this with one line like: 01 my-field pic x(256) value "c:\temp\*". set pattern-text to my-field::TrimEnd & X"00"
↧