• Subject: RE: Embedded SQL problem
  • From: "Danny Rodius" <danny.rodius@xxxxxxxxx>
  • Date: Wed, 31 Oct 2018 18:50:17 +0100
  • Ironport-phdr: 9a23:Gj08gBUohjVjYg0EE+0Q+uR8Cw7V8LGtZVwlr6E/grcLSJyIuqrYbRCOt8tkgFKBZ4jH8fUM07OQ7/i/HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba9wIRmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KhsVRHolTwHNyYn/27Llsx+gqVboBe7qBx+xY7ffYWZOfV6c6/Ye94RWGhPUdtLVyFZAo2ycYUPAOgcM+hWrIfyqEcBoxS5CwmwH+7v1j1FhnDq0aEkz+gtDwfL1xEgEdIUt3TUqc34OKkcX++vyqnIyzXCZO5K1zf69YfIcw0hoeqCUbltdsfe1FMgFwXDjlSQs4DlJTSV2fkMs2iG9OptTvmvi20nqgF3vDev2t0ghZLXiY8MzF3P6Ct3wIEwJdKiSU57Z8apEJ5Rty6HLYt5WMUiQ252tyog1rIGvpu7cDAQx5Qi3RHeavuHc46S7h3/U+aRJC90i2hgeLO+gRa+61Sgyur6W8Kp01hKtjJIn9rRunwXyRDe5ceKRuFj8kqu2TuDzR3f5+NELE0yiKHVMYQuwqQqmZoWqUnDGyj2l1jog6KObUUk//So6/zgYrX7up+QL490hR/6MqQpgsGxD/43Mg4IX2mb4+qxyqXv/Uz/QLpUkv07iqrUvI3AKcgFqaO0DBVZ3pgs5hu/FTuqzdYVkHkfIFJAYh2HjozpO1/UIPD/CPeym0mjny1tx/DAPrztGI/NLn/en7fgYLZ98FVRyBEwzdFf4ZJbFK0BLOjoVUDvrNDYFAM2MxSow+b7D9VwzpkeWXqAAqKWLK/erUaE5uY0LumJZY8apSz9JOIj5/7hk3A1g0MSfa6s3chfVXajA/4zI1mFeWG+xZAFEHwWpUw7TeDwgVuNXHhYYHP1Wqs94jQyDsWiDJzfR4ajh/ubxCjnRsUTYjN6DQXGXk3QWM2cQfADciuXJ85nnXQDU/C9S4Jp9DuL/A6y//pOFa2IonVQvJTvnNlO6vfSmAoGtHM+R5CHy27RFzkxmksNRjMs1aZwrAp2zVLVgoZihPkNX/Ba4fVYGj09OZ/B1KYyX9z7XATQOM2ORFe7Wf29AiA3Q853ydJYMBU1IMmrkh2Wh3niOLQSjbHeWM05
  • List-archive: <https://archive.midrange.com/rpg400-l/>
  • List-help: <mailto:rpg400-l-request@midrange.com?subject=help>
  • List-id: "RPG programming on the IBM i \(AS/400 and iSeries\)" <rpg400-l.midrange.com>
  • List-post: <mailto:rpg400-l@midrange.com>
  • List-subscribe: <https://lists.midrange.com/mailman/listinfo/rpg400-l>, <mailto:rpg400-l-request@midrange.com?subject=subscribe>
  • List-unsubscribe: <https://lists.midrange.com/mailman/options/rpg400-l>, <mailto:rpg400-l-request@midrange.com?subject=unsubscribe>

Hello,

@all
Declaring the qcraneSub variable as sqlvar or varchar works also

Thanks you all for responding.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> On Behalf Of
j.beckeringh@xxxxxxxxxxxxxxxxxxxxxxxxxx
Sent: woensdag 31 oktober 2018 12:01
To: RPG programming on the IBM i (AS/400 and iSeries)
<rpg400-l@xxxxxxxxxxxx>
Subject: Re: Embedded SQL problem

Danny,

Because in the first version you pass a fixed length variable, containing
spaces after the 'interesting' part and in the second version you pass a
trimmed literal, which is automatically cast to a variable length string.

Define qcranesub as varchar(12) and you should be alright..


Joep Beckeringh
Software Architect
Pantheon Automatisering B.V.
Heerenveen

"Danny Rodius" <danny.rodius@xxxxxxxxx>

31-10-2018 11:33

Embedded SQL problem

Hi All,



Have a problem in understanding why one method is working and another
not.

Try to declare a cursor with a select .. When field like ...



Fields: craneSub char(10) & qcraneSub char(12)



The two versions

1. Not working



qcraneSub = '%' + %trim(craneSub) + '%';

exec sql

declare c1 cursor for

select *

from AKA0REP

where a0xhcd = :qcraneID and

a0jxce like :qcraneSub;



2. Working



exec sql

declare c1 cursor for

select *

from AKA0REP

where a0xhcd = :qcraneID and

a0jxce like '%' concat trim(:craneSub) concat '%';



Anyone an idea why the first option is not working?



Danny
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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:
http://amzn.to/2dEadiD


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