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

How to use host variable in Cursor??


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
muhammad

New User


Joined: 25 Oct 2007
Posts: 19
Location: hyderabad

PostPosted: Mon Mar 03, 2008 8:26 pm
Reply with quote

DECLARE CONTACT-CSR CURSOR FOR
SELECT X.CONTACT_FIRST_NM,
X.CONTACT_LAST_NM,
X.CONTACT_EMAIL_ADDR
FROM CONTACT_TABLE X
WHERE X.REF_NUM = : WS-TEMP-NUM

i declared the above cursor in Working Storage section...

I want to move some value in WS-TEMP-NUM and then fetch the cursor...

Its giving compilation error that WS-TEMP-NUM is not a valid host variable.. need help pls...
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Mar 03, 2008 8:29 pm
Reply with quote

muhammad wrote:
DECLARE CONTACT-CSR CURSOR FOR
SELECT X.CONTACT_FIRST_NM,
X.CONTACT_LAST_NM,
X.CONTACT_EMAIL_ADDR
FROM CONTACT_TABLE X
WHERE X.REF_NUM = : WS-TEMP-NUM

i declared the above cursor in Working Storage section...

I want to move some value in WS-TEMP-NUM and then fetch the cursor...

Its giving compilation error that WS-TEMP-NUM is not a valid host variable.. need help pls...


Is ws-temp-num defined? What are the definitions of X.REF_NUM and WS-TEMP-NUM?
Back to top
View user's profile Send private message
muhammad

New User


Joined: 25 Oct 2007
Posts: 19
Location: hyderabad

PostPosted: Mon Mar 03, 2008 8:35 pm
Reply with quote

yeah.. it is defined...

05 WS-REF-NUM-DIV PIC 9(07)

and in the table, REF_NUM is Decimal(7,0) !!!!
Back to top
View user's profile Send private message
muhammad

New User


Joined: 25 Oct 2007
Posts: 19
Location: hyderabad

PostPosted: Mon Mar 03, 2008 8:36 pm
Reply with quote

yeah.. it is defined...

05 WS-TEMP-NUM PIC 9(07)

and in the table, REF_NUM is Decimal(7,0) !!!!
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Mar 03, 2008 8:40 pm
Reply with quote

muhammad wrote:
yeah.. it is defined...

05 WS-TEMP-NUM PIC 9(07)

and in the table, REF_NUM is Decimal(7,0) !!!!


DB2 doesn't use unsigned numbers and the cobol equivalent of decimal is COMP-3, try this.
05 WS-TEMP-NUM PIC S9(7) COMP-3.
Back to top
View user's profile Send private message
muhammad

New User


Joined: 25 Oct 2007
Posts: 19
Location: hyderabad

PostPosted: Mon Mar 03, 2008 9:44 pm
Reply with quote

k.. now iam getting SQL -805
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Mar 03, 2008 10:02 pm
Reply with quote

Look it up in the manual. It is at the top of page 'IBM MANUALS".
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Tue Mar 04, 2008 6:01 pm
Reply with quote

-805 I think is program name not found in plan .. You need to properly BIND your program ...

Cheers icon_smile.gif
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Tue Mar 04, 2008 6:04 pm
Reply with quote

DBRM OR PACKAGE NAME NOT FOUND IN PLAN.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts access the last host command CLIST & REXX 2
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top