Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sql problem with LIKE in WHERE: sqlcode +100

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
pankaj_psm

New User


Joined: 03 May 2005
Posts: 4
Location: Pune

PostPosted: Fri Mar 23, 2007 5:36 pm    Post subject: Sql problem with LIKE in WHERE: sqlcode +100
Reply with quote

Hi there,
I have one problem in COBOL-DB2 -CICS program with LIKE in WHERE clause.This sql runs in SPUFI with hardcoded value but in program it is giving sqlcode +100.
The column in where clause is char(26) and has values like
'SCMTA 20070226093602001' .I want to ignore last 3 digit( i.e. 001) in sql. So value of WS-APLCN should be 'SCMTA 20070226093602%'. OR 'SCMTA 20070226093602&&&'
Please suggest .....

EXEC SQL
UPDATE mytable name
SET column-name = '99'
WHERE column name LIKE :WS-APLCN
END-EXEC.


Pankaj
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Mar 23, 2007 5:42 pm    Post subject:
Reply with quote

Isn't there a substring function you could use?
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Mon Mar 26, 2007 10:07 am    Post subject:
Reply with quote

I believe the host variable value is not populated correctly in the run time.
Make sure % wild char is in place before the execution.

This would not be an efficient method, Instead you can use the bulit in function SUBSTR as suggested by William.

Try this:
EXEC SQL
UPDATE mytable name
SET column-name = '99'
WHERE SUBSTR(colname,1,23) = :WS-APLCN
END-EXEC.

In this case WS-APLCN can have the value 'SCMTA 20070226093602' .
I mean no need for wild char's. Hope this helps. Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us