solve it

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
Abhiyanta
Member
Posts: 7
Joined: Fri Mar 31, 2006 10:37 pm
Location: PUNE

solve it

Post by Abhiyanta » Tue Jul 04, 2006 7:03 pm

Tell me output of following porgram.
:
:
working-storage section.
77 A PIC 9 VALUE IS 1.
:
PROCEDURE DIVISION.
EVALUATE TRUE
WHEN A = 1
DISPLAY "CASE1"
WHEN A <2
DISPLAY "CASE2"
WHEN OTHER
DISPLAY "OTHER"
END-EVALUATE.

srinivas
Member
Posts: 9
Joined: Wed Feb 08, 2006 2:58 pm
Location: Bangalore

Evaluate

Post by srinivas » Wed Jul 05, 2006 2:45 pm

Hi,

It displays CASE1. Once evaluate founds any match it executes the same and skips to next statement of end-evaluate.

sadhana
Member
Posts: 1
Joined: Tue Aug 22, 2006 4:03 pm

Post by sadhana » Tue Aug 22, 2006 4:11 pm

Hi,

Srinivas was right.

rgds,
sadhana
Sadhana

User avatar
arrbee
Active Member
Posts: 144
Joined: Fri Feb 24, 2006 11:33 am

what if I code like this?

Post by arrbee » Thu Sep 07, 2006 10:53 am

What happens if I code like this?

Code: Select all

working-storage section. 
77 A PIC 9 VALUE IS 1. 
&#58; 
PROCEDURE DIVISION. 
EVALUATE TRUE 
WHEN A <2 
DISPLAY "CASE2" 
WHEN A = 1 
DISPLAY "CASE1" 
WHEN OTHER 
DISPLAY "OTHER" 
END-EVALUATE.
which will be displayed? Is it CASE2?
Arr Bee
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)

chris_alex3k
Member
Posts: 3
Joined: Mon Jun 19, 2006 5:23 pm

Answer Please!!!

Post by chris_alex3k » Mon Oct 30, 2006 10:44 am

Hi arrbee,
I think srinivas is correct. As per my knowledge, the output is "case2".
Isn't it correct?

Regards,
Alex.

abhishek.pradhan
Member
Posts: 11
Joined: Wed Nov 08, 2006 4:57 pm

Post by abhishek.pradhan » Sun Nov 12, 2006 7:50 pm

Hi,

Alex is correct. CASE2 will be displayed utill the value of A is changed.

-Abhi

Kgumraj
Member
Posts: 4
Joined: Thu Nov 16, 2006 8:45 pm
Location: Hyderabad

Slove it

Post by Kgumraj » Thu Nov 16, 2006 9:01 pm

Hello,

Cobol supports only sequential excecution.
the value contains CASE1
With Love
Kiran G R

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Nov 16, 2006 9:21 pm

Kgumraj,

The answer to Abhiyanta's question is CASE1.

The answer to arrbee's question is CASE2.
Cobol supports only sequential excecution.
that's a nice phrase, but means nothing.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

User avatar
piyush
Member
Posts: 4
Joined: Fri Sep 07, 2007 12:31 pm
Location: PUNE INDIA

Post by piyush » Fri Sep 07, 2007 2:17 pm

hi All,
i agree with Dick,
if there is any other answer plz let me know. :?:

manitesh_kumar
Member
Posts: 1
Joined: Tue Apr 10, 2007 4:10 pm
Location: Pune

Re: what if I code like this?

Post by manitesh_kumar » Tue Sep 11, 2007 1:12 pm

arrbee wrote:What happens if I code like this?

Code: Select all

working-storage section. 
77 A PIC 9 VALUE IS 1. 
&#58; 
PROCEDURE DIVISION. 
EVALUATE TRUE 
WHEN A <2 
DISPLAY "CASE2" 
WHEN A = 1 
DISPLAY "CASE1" 
WHEN OTHER 
DISPLAY "OTHER" 
END-EVALUATE.
which will be displayed? Is it CASE2?
once any condition for the Evaluate clause is satified the control will come out of the flow.Hence only CASE2 will be displayed.

academyindia4

Topic deleted by Admin

Post by academyindia4 » Wed Jan 27, 2016 8:15 pm

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others