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



This 'or...' worked (SQLLEN is in bytes 3-4 of SQLVAR):
C                   EVAL      %SUBST(SQLVAR:3:1) = X'05'
C                   EVAL      %SUBST(SQLVAR:4:1) = X'00'

But I decided on the following because there is less hard coding (and I
discovered through experimentation that %LEN(srchfld) is needed in the first
byte, not the formula I gave previously):
C                   EVAL      SQLLEN = %DECPOS(ActCityCode) +
C                                      (%LEN(ActCityCode) * 256)

Though it makes perfect sense, I never would have thought of multiplying by
256. Thanks Bruce!

Roger Mackie

-----Original Message-----
From: R. Bruce Hoffman, Jr. [mailto:rbruceh@attglobal.net]
Sent: Wednesday, August 22, 2001 10:57 AM
To: rpg400-l@midrange.com
Subject: Re: SQLLEN of packed field in SQLDA


...message truncated...

or zero the field, add the decimal value, then add the length value times
256.

or....


===========================================================
R. Bruce Hoffman, Jr.
 -- IBM Certified Specialist - AS/400 Administrator
 -- IBM Certified Specialist - RPG IV Developer

"America is the land that fought for freedom and then
  began passing laws to get rid of it."

     - Alfred E. Neuman

-----Original Message-----
From: Mackie, Roger L. (Precision Press) <RLMackie@ppress-tc.com>
To: 'RPG400-L@midrange.com' <RPG400-L@midrange.com>
Date: Wednesday, August 22, 2001 11:16 AM
Subject: SQLLEN of packed field in SQLDA


>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
>
>
>_______________________________________________
>This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
>To post a message email: RPG400-L@midrange.com
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
>or email: RPG400-L-request@midrange.com
>

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.