Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
ayyappa_22523
Warnings : 2

New User

Joined: 02 Jun 2005
Posts: 36

 Posted: Mon Jun 13, 2005 9:45 am    Post subject: COBOL Interview Ques: About PERFORM loops 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

Active User

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

 Posted: Mon Jun 13, 2005 12:03 pm    Post subject: answer is 4.
ayyappa_22523
Warnings : 2

New User

Joined: 02 Jun 2005
Posts: 36

 Posted: Mon Jun 13, 2005 3:08 pm    Post subject: hi radha krishna 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.
kanak

Moderator

Joined: 12 Mar 2005
Posts: 252
Location: India

 Posted: Mon Jun 13, 2005 7:36 pm    Post subject: 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.
ayyappa_22523
Warnings : 2

New User

Joined: 02 Jun 2005
Posts: 36

 Posted: Tue Jun 14, 2005 11:25 am    Post subject: thank u kk 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.
subbprem

New User

Joined: 20 Apr 2005
Posts: 9
Location: Chennai

 Posted: Tue Jun 14, 2005 12:42 pm    Post subject: answer is 3. _________________ regds, Prema.
kanak

Moderator

Joined: 12 Mar 2005
Posts: 252
Location: India

 Posted: Tue Jun 14, 2005 2:04 pm    Post subject: then answer in 3. When a not equla to 1 and b is not equal to 1.
ayyappa_22523
Warnings : 2

New User

Joined: 02 Jun 2005
Posts: 36

 Posted: Wed Jun 15, 2005 7:31 am    Post subject: hi thank u kk and all for slove the prob
flyingSnail

New User

Joined: 15 Jun 2005
Posts: 5
Location: China

 Posted: Thu Jun 16, 2005 12:25 pm    Post subject: I think you should use code-indent method to code your codes, that will make it easier to solve this question.

Active User

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

 Posted: Fri Jun 17, 2005 5:50 pm    Post subject: what is code-indent method?how will it be usefull here?
kanak

Moderator

Joined: 12 Mar 2005
Posts: 252
Location: India

Posted: Fri Jun 17, 2005 6:07 pm    Post subject:

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.

Active User

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

 Posted: Mon Jun 20, 2005 9:20 am    Post subject: Re: COBOL Interview Ques: About PERFORM loops ohhh..I got it.thanks.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to display offset thru cobol prog... tvinodkumar7 CICS 0 Sun Apr 22, 2018 8:42 pm Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm COBOL MVS options BiswajitDG COBOL Programming 8 Fri Apr 06, 2018 12:35 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us