Would the following work? (I'm lazy, haven't tried)
Eval AVar = '''%InSearchString%'''
Exec Sql Select Count(*)
Into :Count
From QTEMP/OUT132
Where OUT132 Like(:AVar);
Rick
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Campin
Sent: Tuesday, 18 January 2011 8:55 AM
To: Midrange Systems Technical Discussion
Subject: Like string in embedded SQL
I need to look for a string like 'Access plan not updated' in an
embedded SQL statement in an RPG program.
If I do the following in STRSQL it works.
SELECT count(*) FROM out132 WHERE OUT132 Like('%Access plan not
updated%')
but the following in embedded SQL does not work.
Exec Sql Select Count(*)
Into :Count
From QTEMP/OUT132
Where OUT132 Like('%:InSearchString%');
When I look at the complied there is no data field being moved in so
obviously it is not seeing the ':' in the string.
Any ideas how to code this so it sees the search string?
I know that one solution would be to use dynamic SQL but would like to
ignore that options if I could.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
***********************************************************************************
The information in this e-mail message and any files transmitted with it are intended to be confidential and for the use of only the individual or entity to whom they are addressed. The message and files may be protected by legal professional privilege, or other legal rules. The confidentiality of and privilege applying to this message and files is not waived if this message or files has been sent to you by mistake. If the reader of this message or files is not the intended recipient, you are notified that retention, distribution or copying of this message and files are strictly prohibited. If you receive this message or files in error, please notify us immediately by telephone or return e-mail and delete all copies from your computer system. It is the recipient's responsibility to check this message and files for viruses.
Thank you.
***********************************************************************************
As an Amazon Associate we earn from qualifying purchases.