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
 

 

cobol,jcl,db2 interview questions.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: cobol,jcl,db2 interview questions.
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Dec 07, 2009 1:58 pm    Post subject: Reply to: cobol,jcl,db2 interview questions.
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: 1238
Location: Richfield, MN, USA

PostPosted: Mon Dec 07, 2009 8:39 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Mon Dec 07, 2009 9:27 pm    Post subject:
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: 1238
Location: Richfield, MN, USA

PostPosted: Mon Dec 07, 2009 9:29 pm    Post subject:
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

Site Director


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

PostPosted: Mon Dec 07, 2009 9:48 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: cobol,jcl,db2 interview questions.
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: 1238
Location: Richfield, MN, USA

PostPosted: Fri Jan 08, 2010 5:43 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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