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
 

 

host variable usage in query

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

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Wed Oct 30, 2013 6:00 pm    Post subject: host variable usage in query
Reply with quote

Hello,

I am writing a cobol code with cursor. Cursor declaration below,

Code:

EXEC SQL
         DECLARE LOADCRSR CURSOR FOR
              SELECT DBR,...
              FROM  DM_IND             
              WHERE DBR = :WS-OLD-A   
              ORDER BY  SEQ_NBR               
              FETCH FIRST 25 ROWS ONLY       
END-EXEC


In the above, I want to make 25 configurable. Number of rows to be fetched may vary for every run. i have to pass it from JCL as PARM. I cannot substituite it with a host variable correct?

Please advise.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Wed Oct 30, 2013 9:30 pm    Post subject:
Reply with quote

1. when reading the syntax of a command, when it says host-variable it means host variable,
when it says n it means a numeric literal.
when it does not stipulate that a host variable can be used (it is not stipulated when host-variable is not contained in the syntax for that command), (i love it when i can find a legal use of a double negative!)
then a host variable cannot be used.

2. why would you want the number of rows to be fetched to be dynamic?
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Wed Oct 30, 2013 10:58 pm    Post subject:
Reply with quote

Quote:

why would you want the number of rows to be fetched to be dynamic?


This is the requirement customer says.

I understand that i can fetch all the rows and later when i write the output, i can restrict the number of rows written to the output. I just little concerned about the performance.

This particular table can have thousands of records for each DBR (Refer where condition in query to understand how DBR is used) and i have more than 800 Million records to extract.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Need inputs on Space requirement and... ashek15 IMS DB/DC 0 Sat Apr 01, 2017 8:26 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm


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