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



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

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

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.