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



Scott Lindstrom wrote:

I think I found it - I switched these around and I in better shape (I
think):

SET MY-PTR UP BY LENGTH OF SQL-STATEMENT-TEXT-LEN
SET ADDRESS OF SQL-STATEMENT-TEXT2 TO MY-PTR

Scott:

I have a trivial example that you might want to review at:

http://code.midrange.com/2025d26869.html

I mostly used your variable names from /COPY, but I simply declared them as individual fields rather than copying the whole /COPY module. I declared SQL-STATEMENT-TEXT2 as a LINKAGE data item as a variable-length array of characters that OCCURS DEPENDING on the length field. It's declared within a 01-level group item that becomes "variable-length" as far as STRING is concerned.

The result of my STRING will show in the joblog, or in Command Entry detailed messages if you call from the command line. The result shows that only "Here is enough text" gets pulled from the variable-length array.

One specific item of caution -- If you're working with QIBM_QZDA_SQL2 with the ZDAQ0200 format, ensure that you do NOT use SQL-STATEMENT-TEXT2-LEN as your length field if it has a value greater than 1024. You might want to declare a different field and either move SQL-STATEMENT-TEXT2-LEN or 1024 into it depending on whether SQL-STATEMENT-TEXT2-LEN is too big. Also, decide how to handle a case where length is zero. Eventually you WILL run across both conditions (among various interesting others).

Tom Liotta


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.