MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using like for a host variable

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
sri50131
Beginner


Joined: 07 Oct 2004
Posts: 38
Topics: 15

PostPosted: Wed Sep 13, 2006 12:56 pm    Post subject: using like for a host variable Reply with quote

Hello,

I am executing the following query in my Cobol pgm;

EXEC SQL
SELECT I_CONTROL, I_SYMBOL
INTO :WS-I-CONTROL, :WS-I-SYMBOL
FROM PAST0170_MASTER
WHERE N_MFG = :WS-VEH-MAKE
AND I_MODEL LIKE RTRIM(:WS-VEH-MODEL) || '%'
AND D_YEAR = :WS-VEH-YEAR
END-EXEC

This is the first time that I ever had to use like in an embedded SQL. The DB2 column I_MODEL has a length of X(61). WS-VEH-MODEL is defined as X(26), this is the Max length that WS-VEH-MODEL can receive.

When I execute the pgm, I am getting SQLCODE = +100. Am I doing anything wrong? Please let me know.

Thanks
Back to top
View user's profile Send private message
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Wed Sep 13, 2006 3:46 pm    Post subject: Reply with quote

Try making WS-VEH-MODEL X(61) and replace trailing spaces with '%'.
Back to top
View user's profile Send private message
sri50131
Beginner


Joined: 07 Oct 2004
Posts: 38
Topics: 15

PostPosted: Wed Sep 13, 2006 4:43 pm    Post subject: Reply with quote

Bithead, I tried it and still am getting a +100.
Back to top
View user's profile Send private message
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Thu Sep 14, 2006 8:44 am    Post subject: Reply with quote

Sri50131,

Make sure that all trailing spaces are converted to %.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group