× 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 everyone,

I'm creating a subfile selection screen that uses dynamic SQL to fill the
subfile. The users will be able search by six different fields. Since the
WHERE clause in a SQL string that will be the host variable of a PREPARE
statement cannot contain a host variable, the program specifies an SQLDA on
the USING DESCRIPTOR clause of the cursor OPEN statement to describe a
parameter marker in the prepared statement. Most of it is working but one
problem remains.

Two of the search fields look in file fields that are packed decimal(SQLTYPE
= 484). Chapter 14.8 of the DB2 for AS/400 SQL Programming manual tells me
the first byte of the SQLLEN 2-byte binary field describing the length of a
packed field needs to be (%LEN(srchfld) + 1)/2 and the second byte needs to
be the field's number of decimal positions. But how do I put those values in
specific bytes of a binary field? I've tried to MOVE hex values and to
substring SQLVAR, but I can't get the right values where they need to be.
Have I missed something in the manuals? What's the best technique for doing
this?

Thanks in advance for your help.

Roger Mackie




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.