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

cobol,jcl,db2 interview questions.


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
indus

New User


Joined: 10 Dec 2008
Posts: 12
Location: Bangalore

PostPosted: Mon Dec 07, 2009 11:42 am
Reply with quote

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
View user's profile Send private message
deepthimadhu

New User


Joined: 03 Mar 2009
Posts: 12
Location: Trivandrum

PostPosted: Mon Dec 07, 2009 12:53 pm
Reply with quote

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
View user's profile Send private message
indus

New User


Joined: 10 Dec 2008
Posts: 12
Location: Bangalore

PostPosted: Mon Dec 07, 2009 1:51 pm
Reply with quote

Thank you Deepthi for your quick reply.

Can any body else also give some views on this.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Dec 07, 2009 1:58 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Mon Dec 07, 2009 8:39 pm
Reply with quote

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
View user's profile Send private message
indus

New User


Joined: 10 Dec 2008
Posts: 12
Location: Bangalore

PostPosted: Mon Dec 07, 2009 9:03 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Dec 07, 2009 9:27 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Mon Dec 07, 2009 9:29 pm
Reply with quote

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. icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Mon Dec 07, 2009 9:48 pm
Reply with quote

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
View user's profile Send private message
cdhami

New User


Joined: 24 Jan 2006
Posts: 28

PostPosted: Wed Dec 16, 2009 2:17 pm
Reply with quote

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
View user's profile Send private message
geeta.mishra

New User


Joined: 27 Dec 2005
Posts: 21
Location: Bangalore

PostPosted: Thu Jan 07, 2010 10:19 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Fri Jan 08, 2010 5:43 am
Reply with quote

Geeta, the question was answered a month ago.
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts Compile Sp Cobol base COBOL Programming 1
No new posts SQLCODE=-311 in Cobol SP-DB2. COBOL Programming 2
Search our Forums:

Back to Top