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

multi-row fetch : Confused in FOR nn ROWS


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

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Nov 18, 2008 6:35 pm
Reply with quote

Hi,
I am writing a COBOL-DB2 program using multi-row fetch. This is the fetch code
Code:
EXEC SQL                                         
  FETCH   NEXT ROWSET FROM ECURSOR FOR :LOOP ROWS
  INTO    :WS-EMPNO :WS-INDI  ,:WS-FIRSTNME     
END-EXEC                                         


Input for the FOR nn rows, it can be either a numeric value or a host variable. That is what i read in this article.

I am getting an error, when a host variable is used, in this place.

Code:
UNDEFINED OR UNUSABLE HOST VARIABLE "LOOP"
HOST VARIABLE "LOOP" IS NOT EXACT NUMERIC WITH SCALE ZERO


This is the declaration of the LOOP variable.
Code:
01 LOOP                        PIC 9(3) VALUE 10.


Can you tell me, where, i am making the MISTAKE.

Thank You,
Sushanth
Back to top
View user's profile Send private message
Cristopher

New User


Joined: 31 Jul 2008
Posts: 53
Location: NY

PostPosted: Tue Nov 18, 2008 7:48 pm
Reply with quote

Hi,
Can you try s9(9) usage comp as picture clause for the LOOP variable.

Cris
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Tue Nov 18, 2008 7:53 pm
Reply with quote

Probably this could support Cris.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Nov 18, 2008 7:56 pm
Reply with quote

Thank You Cristopher, It works
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 To get the count of rows for every 1 ... DB2 3
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Fetch data from programs execute (dat... DB2 3
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
No new posts Code Multi Row fetch in PL1 program PL/I & Assembler 1
Search our Forums:

Back to Top