× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Vern, in the earlier part of this thread from last year, this technique was
discussed (mapping a varying field across an integer followed by a string).

dcl-ds ds;
whatever char(10);
len int(10);
data char(100);
more stuff char(100);
end-ds;

dcl-s varfld varchar(100:4) based(p);
dcl-s p pointer inz(%addr(len));

Chris is doing something like that. Whether it's a good idea or not, I
think it does work.

At least, it works if the length (subfield EZDQLSTL, in Chris's case) is
less than or equal to the defined length of the based VARCHAR field.

Chris, if you can debug this, what is the value of EZDQLSTL when you do the
assignment to Upper?

-- Barbara

-----------------------------------------------------
message: 1
date: Wed, 15 Jan 2020 19:06:10 -0600
from: Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
subject: Re: How do I clip a vary length field?

I think I see the problem, Chris - EZDQLSTL is defined as an integer -
it is the length of the SQL statement, not the statement itself.

There are a couple elements that are described as "varying" - IIRC, that
doesn't mean they are a varying-length field, just that the length is
not fixed in the data structure, and the length is in the above-noted
element. In working with APIs like this, you have to use the offsets and
lengths provided. The SQL statement doesn't have an offset in the DS,
since it is always at a fixed point, but the "extended cursor name" DOES
have an offset, because it is located at different places in the DS,
depending on the length of each instance, where the statements are not
the same length.

you'll need to modify things - you can use a pointer, perhaps, to the
element that follows EZDQLSTL, then a substring on the variable there
and use the length for that.

Have fun!! It's API heaven!

Vern


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.