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

Some 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: Tue Dec 08, 2009 4:57 pm
Reply with quote

1. Is it possible to pass an array to a sub program from main program?
My ans: It is Possible.

2.Can subscript be used instead of index in search.

I did not know the answer.

3.Is it mandatory to use SQLCA in a program:

My ans: It is not mandatory. But if we use it, then only the sql return codes will be available for the program.

4. Can you create a timestamp error for me.
How?
I could not answer that.

Can anyone help me in finding the correct answers.

indus
Back to top
View user's profile Send private message
Lijo

New User


Joined: 24 Aug 2008
Posts: 41
Location: Cochin

PostPosted: Tue Dec 08, 2009 6:02 pm
Reply with quote

I don't know if this is going to be the correct answers, but just sharing my views so that I'll get to know if these are correct:
1. Yes. But you need to pass 'number occurrences of array' also to the receiving program. Then only it can read until that count and fetch individual array elements.
2. My answer is Subscript can't be used in SEARCH clause. But it can used to find an array element, for example: MOVE EMP-ARRY (EMP-NO) to WS-EMP-DETAILS. Here, EMP-NO can be a sub script.
Index is a variable which is not declared/defined anywhere in the COBOL program apart from the mention in OCCURS clause, where as subscript is normally defined in working storage section. When you use a defined variable (subscript) in OCCURS clause, you will get an error as OS try to allocate that variable again. When you do a SEARCH statement, it automatically picks up the index in OCCURS clause and starts search operation.
3. I think you must include SQLCA (SQL Communication Area) in DB2 application program. We'll be using SQLCA variables (at least SQLCODE) to check the success of a query.
4. I suppose by timestamp error you mean -818. To create a -818 (THE PRECOMPILER-GENERATED TIMESTAMP x IN THE LOAD MODULE IS DIFFERENT FROM THE BIND TIMESTAMP y BUILT FROM THE DBRM z ), after making some code changes just do a compilation and link-edit with out binding. Execute the COBOL program. You can see -818.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Dec 08, 2009 6:17 pm
Reply with quote

For number 2, contrary to Lijo's post, a subscript can be used for a serial search. Click on the manuals link at the top of the page, pull up the COBOL Language Reference manual, and look at section 6.2.32 on the SEARCH verb. Binary search doesn't work with a subscript, but you didn't say SEARCH ALL, just SEARCH. Further, a serial search requires an index or subscript to be specified -- it won't "automatically pick(s) up the index in OCCURS clause and starts search operation".
Back to top
View user's profile Send private message
indus

New User


Joined: 10 Dec 2008
Posts: 12
Location: Bangalore

PostPosted: Tue Dec 08, 2009 6:25 pm
Reply with quote

Lijo,

I have a doubt regarding SQLCA usage.
It is not mandatory to use SQLCA rt...With out sqlca also we can have a COBOL-DB2 program. But for checking for return codes we need SQLCA. But that does not mean that it is mandatory.

Just wanted to confirm this doubt...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Dec 08, 2009 10:28 pm
Reply with quote

Hello,

Quote:
It is not mandatory to use SQLCA rt...With out sqlca also we can have a COBOL-DB2 program.
The db2 CALLs generated by the preprocessor refer to sqlca. Without sqlca, the compile fails (at least on the systems i currently support). . . I ran a little test to be sure icon_smile.gif
Back to top
View user's profile Send private message
indus

New User


Joined: 10 Dec 2008
Posts: 12
Location: Bangalore

PostPosted: Tue Dec 08, 2009 10:33 pm
Reply with quote

Thank you very much for that clarification Dick
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Dec 08, 2009 11:02 pm
Reply with quote

You're welcome icon_smile.gif

d
Back to top
View user's profile Send private message
Lijo

New User


Joined: 24 Aug 2008
Posts: 41
Location: Cochin

PostPosted: Wed Dec 09, 2009 1:47 pm
Reply with quote

Thanks Robert for the clarification on point 2.
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 Comp interview questions Mainframe Interview Questions 5
No new posts Interview Questions on Cobol DB2 program Mainframe Interview Questions 5
No new posts The Last Two Question For You To Ask ... Mainframe Interview Questions 0
No new posts Mainframe Interview Questions CICS,CO... Mainframe Interview Questions 6
No new posts Viewing executing process in NDM .. q... IBM Tools 0
Search our Forums:

Back to Top