× 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.



Hi Chris

EZDQLSTL is a 4-byte integer, which might look like junk - from the looks of the data structure, the actual text is always at the same location, after the end of the DS that is defined (note that EZDSQLST00 is commented out). And coincidentally, the actual is immediately after EZDQLSTL, which is why it might work, as Barbara showed.

In another technique, you can set a pointer to the actual text by setting a pointer to the start of the DS, then adding the size of the DS to the pointer to the start of the DS, in order to get the pointer to the actual text, which you might define in any way you want, although that will probably not be a varying-length variable in the way I'm describing.

Then to get your statement, use the minimum of EZDQLSTL and the length of your statement variable. Use that minimum as the length of a substring function.

I hope that makes some sense. It is a fairly standard way to get text of varying length out of an API, if I am stating it correctly. One thought - your DS does not need to have the SQL text in it - you can trust the API to allocate the memory need for that statement, so once you have a pointer to THAT space, you can get the data at that location in memory.

Vern

On 1/16/2020 11:06 AM, Chris Holko wrote:
EZDQLSTL appears as junk, using the code sample I posted earlier; it is the simplest way to demo my issue; data_in looks right but I am of the opinion I am making a pointer to the wrong variable.I cannot determine how to put a pointer to what is received on entry to the program as I would have suspected a qualified name for the data structure but that isn’t right.

I am not looking for a gimmick solution and sorry if I implied that earlier. I am trying to receive in the data from the exit point regardless of size and I need to deal with it in more than one size as the program processes the data. Hence the need to move a portion to a much smaller variable. I used 128 because I can easily submit statements larger than that.



On Jan 16, 2020, at 10:44 AM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:

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

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.