IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Cobol Host Variables not populated


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
aq16

New User


Joined: 04 Mar 2006
Posts: 3

PostPosted: Sun Feb 07, 2010 9:57 pm
Reply with quote

Hi All,

I have a COBOL+DB2 batch program having a SQL SELECT statement with 'WHERE' clause on Primary key.

I pass the primary key into host variable before EXEC SQL SELECT statement , after returning from DB2 the SQLCODE is 0 but the sleected column host variables are not getting populated.

What may be the problem?

Thanks in advance,
Shishir
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sun Feb 07, 2010 10:34 pm
Reply with quote

How about posting the select and the host variables?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Feb 08, 2010 12:31 am
Reply with quote

Hello,

In addition to posting the requested code, what happens if you run this query in spufi?
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Feb 17, 2010 6:29 pm
Reply with quote

You failure to follow up the request for the actual SQL you intend to execute may indicate that you have found the solution, but anyway:

A common mistake made by programmers is that they expect values for host variables used in the where statement to be updated with the actual value for a fetched row.

You should include the wanted column in the select into a host variable to get the actual value.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top