View previous topic :: View next topic |
Author |
Message |
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Thu Apr 22, 2004 11:36 am Post subject: change the following IF condition to EVALUATE statement |
|
|
Hi ,
Can u help me in changing the following IF condition using EVALUATE
Code: |
IF (var-a = SPACES) OR
(var-b NOT = 'B')
SET K-MSG TO TRUE
ELSE
GO TO 2000-EXIT
END-IF
|
|
|
Back to top |
|
|
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Thu Apr 22, 2004 11:47 am Post subject: |
|
|
sorry friends.I got it
Code: |
EVALUATE TRUE
WHEN VAR-A = SPACES
SET K-MSG TO TRUE
WHEN VAR-B NOT = 'B'
SET K-MSG TO TRUE
WHEN OTHER
GO TO 2000-EXIT
END-EVALUATE
|
VIjay |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Apr 22, 2004 11:57 am Post subject: |
|
|
vijay,
You can combine the first when into one condition
Code: |
EVALUATE TRUE
WHEN VAR-A = SPACES
WHEN VAR-B NOT = 'B'
SET K-MSG TO TRUE
WHEN OTHER
GO TO 2000-EXIT
END-EVALUATE
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
JOHNCWL Beginner
Joined: 25 Feb 2004 Posts: 31 Topics: 16
|
Posted: Fri Apr 30, 2004 8:24 am Post subject: |
|
|
Hi Kolusu,
I would like to know from performance point of view, whether IF -THEN-ELSE is better or Evaluate is better.
In the same context Any alternative to Perform statement in Cobol, to improve the performance?? |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
Fin Beginner
Joined: 19 Jan 2004 Posts: 27 Topics: 8
|
Posted: Fri Jan 28, 2005 6:33 am Post subject: |
|
|
If I have a variable A and comparing it with B is this legal?
EVALUATE A
WHEN = WS-IN-CONTRACT-NUM
Do some processing
WHEN > B
Do other processing
WHEN < B
Do something else
Or - does there have to be an identifer or literal value straight after each 'WHEN' |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Fri Jan 28, 2005 8:14 am Post subject: |
|
|
Fin,
You syntax is not a valid syntax. try this
Code: |
EVALUATE TRUE
WHEN A = WS-IN-CONTRACT-NUM
Do some processing
WHEN A > B
Do other processing
WHEN A < B
Do something else
END-EVALUATE
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Sun Jan 30, 2005 12:35 pm Post subject: |
|
|
Hi Fin,
You didn't define the variables, so my proposed solution may have to be adjusted to fit. I haven't tested this but it seems like it should work.
Just another way to skin this particular cat. I wonder what a
performance comparison would show?
Code: |
EVALUATE A
WHEN WS-IN-CONTRACT-NUM
Do some processing
WHEN B + 1 THRU 999
Do other processing
WHEN 0 THRU B - 1
Do something else
END-EVALUATE |
_________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
|
|
|