Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
[Solved]COBOL Interview Ques: About PERFORM loops

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
ayyappa_22523
Warnings : 2

New User


Joined: 02 Jun 2005
Posts: 36
Location: Hyderabad

PostPosted: Mon Jun 13, 2005 9:45 am    Post subject: COBOL Interview Ques: About PERFORM loops
Reply with quote

i had a loop is


how to perform d .

if a = 1

if b = 1
perform c
end if.
else if b=1

perform c.

else

perform d.


i want to perform d.

ans is 1. a= 1 b = 1
2. a=2 b=1
3. a = 2 b = 2
4.a =1 b = 2
Back to top
View user's profile Send private message

radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 436
Location: chennai, India

PostPosted: Mon Jun 13, 2005 12:03 pm    Post subject:
Reply with quote

answer is 4.
Back to top
View user's profile Send private message
ayyappa_22523
Warnings : 2

New User


Joined: 02 Jun 2005
Posts: 36
Location: Hyderabad

PostPosted: Mon Jun 13, 2005 3:08 pm    Post subject: hi radha krishna
Reply with quote

i hope u have to cheet it once because here i use endif. after first if.

if a = 1 means . tha will perform c. a = 2 means it will come esle if part.

and elseif belongs to first if .


second if will be terminated by end if.
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Mon Jun 13, 2005 7:36 pm    Post subject:
Reply with quote

i think it will give compilation error as there is period after end-if.
hence next else will be wrong. same way after perform c.
if code is somewhat llike only one period after perform D then i think answer will be 3.
i.e. a=2 then it will come to next if part and then if b=2 then it will cme to else part and execute D.
ayyappa_22523 can you please check the period, where it should be exactly.
Back to top
View user's profile Send private message
ayyappa_22523
Warnings : 2

New User


Joined: 02 Jun 2005
Posts: 36
Location: Hyderabad

PostPosted: Tue Jun 14, 2005 11:25 am    Post subject: thank u kk
Reply with quote

i will give it clearly now


if a= 1 then

if b=1 then

preform c
end- if
else if b =1 then

perform c
else

perfom d.

then u have to say.
Back to top
View user's profile Send private message
subbprem

New User


Joined: 20 Apr 2005
Posts: 9
Location: Chennai

PostPosted: Tue Jun 14, 2005 12:42 pm    Post subject:
Reply with quote

answer is 3.
_________________
regds,
Prema.
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Tue Jun 14, 2005 2:04 pm    Post subject:
Reply with quote

then answer in 3. When a not equla to 1 and b is not equal to 1.
Back to top
View user's profile Send private message
ayyappa_22523
Warnings : 2

New User


Joined: 02 Jun 2005
Posts: 36
Location: Hyderabad

PostPosted: Wed Jun 15, 2005 7:31 am    Post subject: hi
Reply with quote

thank u kk and all for slove the prob
Back to top
View user's profile Send private message
flyingSnail

New User


Joined: 15 Jun 2005
Posts: 5
Location: China

PostPosted: Thu Jun 16, 2005 12:25 pm    Post subject:
Reply with quote

I think you should use code-indent method to code your codes, that will make it easier to solve this question.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 436
Location: chennai, India

PostPosted: Fri Jun 17, 2005 5:50 pm    Post subject:
Reply with quote

what is code-indent method?how will it be usefull here?
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Fri Jun 17, 2005 6:07 pm    Post subject:
Reply with quote

hai radhakrishnan v ,
code indent methos is nothing but all the if,else and end-if should come in the same line so that you better way to describe the code. For example:
Code:

if a= 1 then
   if b=1 then   
         preform c
   end- if
else
   if b =1 then
      perform c
   else     
      perfom d.


I hope this is what flyingSnailmeant. If wrong then please correct me.
Back to top
View user's profile Send private message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 436
Location: chennai, India

PostPosted: Mon Jun 20, 2005 9:20 am    Post subject: Re: COBOL Interview Ques: About PERFORM loops
Reply with quote

ohhh..I got it.thanks.
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. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us