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
 

 

multi-row fetch : Confused in FOR nn ROWS

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

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Tue Nov 18, 2008 6:35 pm    Post subject: multi-row fetch : Confused in FOR nn ROWS
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    Post subject: Reply to: multi-row fetch : Confused in FOR nn ROWS
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    Post subject:
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: 1013
Location: India

PostPosted: Tue Nov 18, 2008 7:56 pm    Post subject:
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    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 DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts Can we use OPTIMIZE FOR 1 ROWS for fe... cvijay784 DB2 1 Fri Aug 05, 2016 11:56 am


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