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

Interview questions i faced.


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

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Wed May 11, 2011 12:56 pm
Reply with quote

Hi All,
These are the interview questions i faced.
1) there is a table where there are 3 rows for each subject for a student like
Student no Student name History Physics Chemistry
001 AAA 98
001 AAA 97
001 AAA 96
like above and he need answer as Student no Student name student total
001 AAA 291
like this
i don't know how to write a query for this

2) Program A is calling Program B
my requirement is that Program B should be designed in such a way that it should act as a stand alone program and also like a calling program?
i said through Exit we can but the interviewer not correct

3) there is a table where we have to delete the yesterday rows and insert today s rows and there are millions of rows how can we design a program for this requirement.?
i told we can delete the rows by giving range and we can commit for every 10000 rows.

4) i am moving a numeric value to alphabetic when we compile the program will i get an error or when we run the jcl ?
i said while compiling but don't know what error will be thrown.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1315
Location: Vilnius, Lithuania

PostPosted: Wed May 11, 2011 1:07 pm
Reply with quote

anandinmainframe wrote:
4) i am moving a numeric value to alphabetic when we compile the program will i get an error or when we run the jcl ?
i said while compiling but don't know what error will be thrown.

The question is senseless, in REXX and PL/I you can move numerical values to character. In REXX anything is character anyway, and in PL/I the compiler will just warn you and call a library subroutine at runtime to do the move.
Back to top
View user's profile Send private message
Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Wed May 11, 2011 1:26 pm
Reply with quote

I think it will only throw error in case of arithmetic operations on alphabetic variable, otherwise it looks fine to me.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Wed May 11, 2011 1:43 pm
Reply with quote

Quote:
4) i am moving a numeric value to alphabetic when we compile the program will i get an error or when we run the jcl ?
i said while compiling but don't know what error will be thrown.


Are You sure that the question was posed in that way ?

if the masks/pictures/lengths are reasonably consistent a plain move will be happily executed in both directions

at most You might get a warning at compile time

if like in this case <alphabetic> applies to the definition - PIC X for COBOL or CHAR for PL/1

at run time the output depends on the content of the <alphabetic> field
the move will be <generally> happily executed,
the failure might happen later, on real arithmetic oprerations
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed May 11, 2011 2:48 pm
Reply with quote

Quote:
4) i am moving a numeric value to alphabetic when we compile the program will i get an error or when we run the jcl ?
i said while compiling but don't know what error will be thrown.
In COBOL, you cannot move a PIC 9 variable to a PIC A variable -- this causes a compile error. Moving a PIC 9 variable to a PIC X variable is perfectly legal in COBOL and is not a problem.
Back to top
View user's profile Send private message
Tushar Sood

New User


Joined: 26 Oct 2008
Posts: 14
Location: New Jersey

PostPosted: Wed May 11, 2011 9:44 pm
Reply with quote

For the 1st question, i guess the following query will do -

Select Studentno, studentname,sum(marks) as TotalMarks
from studenttable
group by studentno;
Back to top
View user's profile Send private message
Bang_1

New User


Joined: 08 May 2009
Posts: 39
Location: Bangalore

PostPosted: Wed May 11, 2011 10:39 pm
Reply with quote

In COBOL, data type compatability error comes during the compilation.
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Thu May 12, 2011 9:41 am
Reply with quote

Hi All,
I have posted the same question which was asked by the Interviewer.
Tushar Sood,
AFAIK that query will not work.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu May 12, 2011 2:05 pm
Reply with quote

Correction:- for the 1st query
Select Studentno, studentname,sum(marks) as TotalMarks
from studenttable
group by studentno,studentname;
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Thu May 12, 2011 3:51 pm
Reply with quote

history,physics,chemistry is different columns there was a aligning mistake so you cannot sum with different columns
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Thu May 12, 2011 4:10 pm
Reply with quote

The only mistake in alignment was you not putting code tags around your example. Code tags preserve spacing and are not just for code.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu May 12, 2011 4:26 pm
Reply with quote

the way the question was posed really sucks:
Code:

Student no Student name History Physics Chemistry
001             AAA        98
001             AAA                 97
001             AAA                        96

which does not make any sense.

either you have 3 subjects per row, meaning your columns are:
  • Student no
  • Student name
  • History
  • Physics
  • Chemistry

and you have 1 row per student.
thus the sql would be
Code:

select student_no
       , student_name
       , sum(history + physics + chemistry)
from...
order by 1,2

or you have a row that includes:
  • Student no
  • Student name
  • subj code
  • mark

where possibly, there would be three rows per student, one for each subj and grade.
and the sql would be
Code:

select student_no
       , student_name
       , grade
from...
group by  student_no
       , student_name
       , grade
order by 1?2?

as Nic said, use BB code to display your design, so that someone can make sense of the topic.
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 What is the most complex abend you've... Mainframe Interview Questions 8
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
Search our Forums:

Back to Top