View previous topic :: View next topic
|
Author |
Message |
indus
New User
Joined: 10 Dec 2008 Posts: 12 Location: Bangalore
|
|
|
|
1. I am using a cusor in the program. Where do I move a value to a host variable, Is it before opening cursor or after?
My answer was we can move before and after.
2. Scrolling logic in CICS.
I did not know the answer.
Can anybody help me in finding out the correct answers. |
|
Back to top |
|
|
deepthimadhu
New User
Joined: 03 Mar 2009 Posts: 12 Location: Trivandrum
|
|
|
|
I think the values fetched from a select statement can be moved to host variable only after opening the cursor.
For eg:
DECLARE cursorname CURSOR FOR SELECT
field-1,field-2 FROM tablename WHERE condition;
The WHERE condition can have host variables. But the values selected from the above query can be moved to the host variables only after opening the cursor.
OPEN cursorname;
FETCH cursorname
INTO :ws-field-1,
:ws-field-2
where ws-field-1, ws-field-2 etc are host variables.
Please correct me if am wrong |
|
Back to top |
|
|
indus
New User
Joined: 10 Dec 2008 Posts: 12 Location: Bangalore
|
|
|
|
Thank you Deepthi for your quick reply.
Can any body else also give some views on this. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
nothing to add but let' s reword for clarity
Quote: |
But the values selected from the above query can be moved to the host variables only after opening the cursor.
OPEN cursorname; |
the subsequent FETCH will fill the host variables specified in the FETCH with the data from the columns specified in the DECLARE CURSOR |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
One point that hasn't explicitly been stated so far is that any host variables in the predicate (WHERE clause) must be populated BEFORE opening the cursor. |
|
Back to top |
|
|
indus
New User
Joined: 10 Dec 2008 Posts: 12 Location: Bangalore
|
|
|
|
So what ever host variables we are using in the where clause can not be moved after opeing the cursor? Is it?
Thank you Terry for your help. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
indus wrote: |
So what ever host variables we are using in the where clause can not be moved after opeing the cursor? Is it? |
Hold for second and think what WHERE clause is doing in a simple fetch query?
Consider this,
Code: |
select * from table
WHERE something=some-value |
if you don't have "some-value" already with your program "something" would be compared to what? |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
That's right. It's too late then since the opening of the cursor will use the value(s) of the host variables in the WHERE clause AT THE TIME OF THE OPEN. The equivalent would be like populating the source of a COBOL MOVE statement AFTER the MOVE has been executed instead of BEFORE. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
2. Scrolling logic in CICS.
I did not know the answer. |
Most systems have a standard way to implement scrolling. One should use the standard method for the system they are using.
Basically, scrolling is starting "somewhere" (value specified by the user) and reading enough data to fill the available lines on the screen (either forward or backward). |
|
Back to top |
|
|
cdhami
New User
Joined: 24 Jan 2006 Posts: 28
|
|
|
|
Hi,
Scrolling can be done by appln program logic.
Our workshop has data written to TSQ for single screen ..and when page down is performed, it fetched data continuing from last value and keeps filling the TSQ.
page up will read from TSQ instead of table ( if table is not expected to change)
Thx
CD |
|
Back to top |
|
|
geeta.mishra
New User
Joined: 27 Dec 2005 Posts: 21 Location: Bangalore
|
|
|
|
Hi,
Answer to the 1st question is: we should move the value in a host variable before opening the cursor.
Regards,
Geeta |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Geeta, the question was answered a month ago. |
|
Back to top |
|
|
|