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

Evaluate verb for a condition checking


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kovur

New User


Joined: 15 Nov 2007
Posts: 36
Location: India

PostPosted: Tue May 06, 2008 10:28 am
Reply with quote

Hi,
I am using Evaluate verb for a condition checking.
Code:

Evaluate True
  when <flag>
      do some processing
 when <flag>
      do some processing
 when other
     go to abend routine
End-Evaluate.


Here, the problem is, although one of the when conditions is true, the evaluate is still going to When Other. It is happening only with this evaluate. Other evaluates I am using in the program has no problem.
What might be the cause?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue May 06, 2008 11:00 am
Reply with quote

Code:

when <flag>


since you know so much, provide your own answer.

If you expect help, provide storage definitions of references used in the evaluate.

what you have provided will garner you nothing.
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 May 06, 2008 11:05 am
Reply with quote

Hello Kovur,

Said differently - it is obvious to us that the code giving you trouble is not the code you posted.

If you don't post the code that is failing, we cannot help.
Back to top
View user's profile Send private message
kovur

New User


Joined: 15 Nov 2007
Posts: 36
Location: India

PostPosted: Tue May 06, 2008 1:46 pm
Reply with quote

Code:

Evaluate True
   when wf-rec1
     do some processing
   when wf-rec2
     do some processing
   when other
      abend the program
End-Evaluate


here, wf-rec1 and wf-rec2 are the 88 level variables which are set to true before coming to this evaluate.

Here, when wf-rec1 is true, it is doing the processing below it and then coming to when other instead of coming out of evaluate.
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 May 06, 2008 1:52 pm
Reply with quote

Hello,

Post the real code - not what you are posting. This would include the variables definitions.

Also, post one of the "evaluate's" that is working - again the real code.

If the requested info is not posted, i'll lock this topic - to continue this way is just wasting time.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Tue May 06, 2008 1:57 pm
Reply with quote

sure you cannot figure out what's happening with just 3 or 4 DISPLAYs?
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Tue May 06, 2008 3:00 pm
Reply with quote

how can anyone tell that the program is performing as stated by kovur by simply looking at the code provided.
the when other part states that the program should go to the abend routine. the program may also go to the abend routine by some other reason.

so, until and unless kovur sends the detailed code, its very difficult to respond.
Back to top
View user's profile Send private message
kovur

New User


Joined: 15 Nov 2007
Posts: 36
Location: India

PostPosted: Fri May 09, 2008 9:58 am
Reply with quote

Hi Guys,
I found a strange thing with Evaluate while expediting.

case 1
-----------------
If we write continue in WHEN OTHER, expeditor is going to when other, executing continue and coming out of evaluate.
I will give U an example,

Code:

Evaluate true
when wf-mrec1
 move a to b
 move c to d
when wf-mrec2
 move x to y
 move s to t
when other
 continue
End-Evaluate
.

now, although one of the when condition is true, after executing that condition, evaluate is coming to when other, going thru continue and coming out of evaluate.

case 2
---------------------------
In another case, if we write one more statement after continue in when other, it is not going to when other.
Code:

Evaluate true
when wf-mrec1
 move a to b
 move c to d
when wf-mrec2
 move x to y
 move s to t
when other
 continue
 add 1 to wa-count
End-Evaluate
.

In this case, after executing one of the when conditions, control is coming out of the evaluate.

case 3
------------------------
In one more case if I write a statement before cotinue in when other, control is coming to when other, not executing the statement before continue but directly coming to continue and exiting out of evaluate.

Code:

Evaluate true
when wf-mrec1
 move a to b
 move c to d
when wf-mrec2
 move x to y
 move s to t
when other
  add 1 to wa-count
  continue
End-Evaluate
.


Here, after executing one of the when conditions, control is coming to when other, not executing the add statement but coming to continue and exiting out of evaluate.

Of course there is no problem in the fuctionality of the code as it is executing only continue in when other, but my question is why it is going to when other and passing thru continue? Once any when condition is true, the evaluate should end. But don't know why it is happening like this.
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: Fri May 09, 2008 10:32 am
Reply with quote

Hello Kovur,

One last chance (because it does look like you are trying). . .

You must post the real code that is in your program icon_evil.gif

What you are running and what you are posting is not the same and therefore pretty much worthless.

As i mentioned before:
Quote:
This would include the variables definitions.
Also, post one of the "evaluate's" that is working - again the real code.
Back to top
View user's profile Send private message
kovur

New User


Joined: 15 Nov 2007
Posts: 36
Location: India

PostPosted: Fri May 09, 2008 11:07 am
Reply with quote

Dick, But I found this thing with evaluate in other sections also.
Asking some one to try it out and confirm.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Fri May 09, 2008 2:47 pm
Reply with quote

Kovur,

how did you judge that it is going to the continue verb ???

as you said if there is a stmt before or after continue it is not executing those stmts and why do u think it is executing continue stmt ???
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri May 09, 2008 6:06 pm
Reply with quote

Ashimer's question is the one to answer.
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: Fri May 09, 2008 6:27 pm
Reply with quote

Hello Kovur,

Quote:
Dick, But I found this thing with evaluate in other sections also.
Asking some one to try it out and confirm.
Many of us have evaluate code that does not do as you are seeing in your program. That is the main reason for asking to see the exact code that is doing this.

Something you might try is to clone the problem code into a very small module that is basically only an evaluate and have the code work from ws fields only - no 88's, no fd's, etc. If this simplified close still does this strange behaviour, you could post the entire module and some of us could run it on our machines and post our results.

Good luck and we'll keep on with this 'til we get it icon_smile.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri May 09, 2008 6:27 pm
Reply with quote

xpeditor sometimes has misleading behaviour.

as you step thru EVALUATES, nested IF's, it seems as if an instruction is being executed but it is not.

xpeditor seems to always hilight a continue verb, regardless. This is misleading to rookies.

actually, this discussion is just bs. for the op to use xpeditor behaviour as the definition of what is being executed just shows his inexperience.

the op has still not provided his code/jcl and output. i doubt if he will, seems a little thickheaded.

my advice to kovur,

stop trying to find a bug in the compiler or the op-system.

why don't we close this thread.........sure have wasted a lot of time.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri May 09, 2008 8:13 pm
Reply with quote

dbzTHEdinosauer wrote:
xpeditor sometimes has misleading behaviour.
xpeditor seems to always hilight a continue verb, regardless. This is misleading to rookies.

Dick,

I think the highlighting is a blessing in disguise for us.

What if Compuware decided to display a CONTINUE instead as "A CONDITIONAL NOOP". icon_exclaim.gif

Let the games begin! icon_wink.gif

Regards,

Bill
Back to top
View user's profile Send private message
Prakash RS

New User


Joined: 17 Mar 2008
Posts: 2
Location: Bangalore

PostPosted: Mon Jun 23, 2008 3:22 pm
Reply with quote

IF TEMP-FILE-ID NOT EQUAL CURR-FILE-ID AND CURR-FILE-TYPE = '01'
MOVE SPACES TO XXXX FIELD
MOVE 'YYYY-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA
END-IF.


IF TEMP-FILE-ID NOT EQUAL CURR-FILE-ID AND CURR-FILE-TYPE = '02'
MOVE SPACES TO XXXX FIELD
MOVE 'ZZZZ-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA
END-IF.

IF TEMP-FILE-ID NOT EQUAL CURR-FILE-ID AND CURR-FILE-TYPE = '03'
MOVE SPACES TO XXXX FIELD
MOVE 'WWW-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA
END-IF.

Can I code above IF statement like this (Syntax),

EVALUATE TEMP-FILE-ID NOT EQUAL CURR-FILE-ID AND CURR-FILE-TP

WHEN TRUE AND '01'
MOVE SPACES TO XXXX FIELD
MOVE 'YYYY-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA

WHEN TRUE AND '02'
MOVE SPACES TO XXXX FIELD
MOVE 'ZZZZZ-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA

WHEN TRUE AND '03'
MOVE SPACES TO XXXX FIELD
MOVE 'WWW-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA

WHEN OTHER
CONTINUE.
END-EVALUATE.

Thanks, icon_smile.gif
Prakash
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Mon Jun 23, 2008 3:33 pm
Reply with quote

Hi Prakash,

Use this construct

Code:


EVALUATE TRUE ALSO CURR-FILE-TP

WHEN TEMP-FILE-ID NOT EQUAL CURR-FILE-ID  ALSO '01'
MOVE SPACES TO XXXX FIELD
MOVE 'YYYY-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA

WHEN TEMP-FILE-ID NOT EQUAL CURR-FILE-ID  ALSO '02'
MOVE SPACES TO XXXX FIELD
MOVE 'ZZZZZ-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA

WHEN TEMP-FILE-ID NOT EQUAL CURR-FILE-ID  ALSO '03'
MOVE SPACES TO XXXX FIELD
MOVE 'WWW-NAME' TO XXXX FIELD
PERFORM 10-INSERT-PARA

WHEN OTHER
CONTINUE

END-EVALUATE.

Back to top
View user's profile Send private message
Prakash RS

New User


Joined: 17 Mar 2008
Posts: 2
Location: Bangalore

PostPosted: Mon Jun 23, 2008 3:55 pm
Reply with quote

Hi Ashimer,

Thanks for the reply.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Evaluate variable to execute a jcl step JCL & VSAM 3
No new posts How to give complex condition in JCL . CLIST & REXX 30
No new posts REXX - Dataset checking in a do forev... CLIST & REXX 6
No new posts selectively copy based on condition DFSORT/ICETOOL 3
This topic is locked: you cannot edit posts or make replies. Control-m JOB executing even when the... Compuware & Other Tools 6
Search our Forums:

Back to Top