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



Dwight,

AFAIK, no. An alpha literal needs quotes around it to identify it as an
alpha literal. An alpha host variable does not because SQL "knows" it as an
alpha host variable.

HTH,

Kevin Wright

> -----Original Message-----
> From: dslessman@nationalelectrical.com
> [mailto:dslessman@nationalelectrical.com]
> Sent: Tuesday, 6 March 2001 14:08
> To: RPG400-L@midrange.com
> Subject: RE: Embedded SQL problem
> 
> 
> 
> Kevin,
> 
> I thought character fields would need single quotes around them.
> 
> SearchValue is defined as a fixed length character field 
> (length of 35).
> 
> Do I need additional percentage symbols?
> 
> Thanks,
> 
> Dwight
> 
> 
>                                                               
>                                                     
>                     Kevin Wright                              
>                                                     
>                     <Kevin.Wright@lan        To:     
> RPG400-L@midrange.com                                        
>                     sa.com.au>               cc:              
>                                                     
>                     Sent by:                 Subject:     RE: 
> Embedded SQL problem                                
>                     owner-rpg400-l@mi                         
>                                                     
>                     drange.com                                
>                                                     
>                                                               
>                                                     
>                                                               
>                                                     
>                     03/05/2001 07:08                          
>                                                     
>                     PM                                        
>                                                     
>                     Please respond to                         
>                                                     
>                     RPG400-L                                  
>                                                     
>                                                               
>                                                     
>                                                               
>                                                     
> 
> 
> 
> 1) SearchValue does not need the quotes wrapping it, to the best of my
> knowledge
> 2) How is SearchValue defined? If it is fixed length, either make it
> variable length or add trailing percentage symbols beyond the 
> "significant
> characters".
> 
> HTH,
> 
> Kevin Wright
> 
> > -----Original Message-----
> > From: dslessman@nationalelectrical.com
> > [mailto:dslessman@nationalelectrical.com]
> > Sent: Tuesday, 6 March 2001 9:05
> > To: RPG400-L@midrange.com
> > Subject: Embedded SQL problem
> >
> >
> > I am having the following problem in an RPGLE program.  I
> > cannot get the
> > system to properly perform the selection using the "Like"
> > keyword and a
> > variable.
> >
> > Here is some sample code that works:
> > C/Exec Sql
> > C+  Declare GetAltNam Cursor For
> > C+    Select ITEMCBS,
> > C+           THCKCBS,
> > C+           WDTHCBS,
> > C+           LNGTCBS,
> > C+           GRADCBS
> > C+      From ALTNAM,
> > C+           BRSHSPC
> > C+      Where ITEMCBS = ITEMAN And
> > C+            NAMEAN Like '10-1015%'
> > C+      Order By ITEMCBS
> > C/End-Exec
> >
> > This search works great.
> >
> > Obviously I do not want to hardcode the search criteria.
> > When I add the
> > following, the application should return the same information
> > as above but
> > it does not.
> > C                   Eval      SearchValue = '10-1015%'
> > C                   Eval      SearchValueH = SearchValue
> > C                   Eval      SearchValue = '''' +
> > %Trim(SearchValueH)+
> > C                             ''''
> >  *  Declare cursors.
> > C/Exec Sql
> > C+  Declare GetAltNam Cursor For
> > C+    Select ITEMCBS,
> > C+           THCKCBS,
> > C+           WDTHCBS,
> > C+           LNGTCBS,
> > C+           GRADCBS
> > C+      From ALTNAM,
> > C+           BRSHSPC
> > C+      Where ITEMCBS = ITEMAN And
> > C+            NAMEAN Like :SearchValue
> > C+      Order By ITEMCBS
> > C/End-Exec
> >
> > I added a variable (I will later pass this as a parameter).
> > I put code in
> > to place single quotes around the search value.  Nothing is
> > returned in the
> > result and I receive no error messages.
> >
> > Does someone see the mistake I am making?
> >
> > Thanks in advance for your help,
> >
> > Dwight Slessman
> >
> > ps.  We are at V4R5 with database group PTF 4 on.
> >
> >
> > +---
> > | This is the RPG/400 Mailing List!
> > | To submit a new message, send your mail to RPG400-L@midrange.com.
> > | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> > | To unsubscribe from this list send email to
> > RPG400-L-UNSUB@midrange.com.
> > | Questions should be directed to the list owner/operator:
> > david@midrange.com
> > +---
> >
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to 
> RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
> david@midrange.com
> +---
> 
> 
> 
> 
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to 
> RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: 
> david@midrange.com
> +---
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to 
> RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: 
> david@midrange.com
> +---
> 
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@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.