View previous topic :: View next topic
|
Author |
Message |
venosol Warnings : 1 New User
Joined: 16 Nov 2006 Posts: 43 Location: Bangalore
|
|
|
|
Can we use if conditions in Display statement. If so how?
thanx. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
What do u mean by that?
Would you please restate ur query? |
|
Back to top |
|
|
venosol Warnings : 1 New User
Joined: 16 Nov 2006 Posts: 43 Location: Bangalore
|
|
|
|
guptae wrote: |
Hi There,
What do u mean by that?
Would you please restate ur query? |
Generally we will be using DISPLAY for displaying some message
DISPLAY 'THE AMOUNT AFTER CALCULATION IS:' WS-AMOUNT.
Instead of WS-AMOUNT I will write some calculation using conditions.
IF WS-COUNT > 0
WS-AMOUNT = WS-COUNT * 12
ELSE
WS-AMOUNT = 0.
I want to use this kind of conditions in display statement. Will it work. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
Again i am not able to understand |
|
Back to top |
|
|
venosol Warnings : 1 New User
Joined: 16 Nov 2006 Posts: 43 Location: Bangalore
|
|
|
|
guptae wrote: |
Hi There,
Again i am not able to understand |
DISPLAY 'THE AMOUNT AFTER CALCULATION IS:' IF WS-COUNT > 0
WS-AMOUNT = WS-COUNT * 12
ELSE
WS-AMOUNT = 0.
Will the above statement work now. Treat it as a single statement. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi venu,
I dont think its possible but u can do like
Code: |
IF WS-COUNT > 0
COMPUTE WS-AMOUNT = WS-COUNT * 12
ELSE
COMPUTE WS-AMOUNT = 0.
DISPLAY 'THE AMOUNT AFTER CALCULATION IS :' WS-AMOUNT. |
[/code] |
|
Back to top |
|
|
venosol Warnings : 1 New User
Joined: 16 Nov 2006 Posts: 43 Location: Bangalore
|
|
|
|
guptae wrote: |
Hi venu,
I dont think its possible but u can do like
Code: |
IF WS-COUNT > 0
COMPUTE WS-AMOUNT = WS-COUNT * 12
ELSE
COMPUTE WS-AMOUNT = 0.
DISPLAY 'THE AMOUNT AFTER CALCULATION IS :' WS-AMOUNT. |
[/code] |
So funny answer Ekta. Any way thnx for your suggestion. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Instead of asking this on forum, why dont you give it a try yourself? |
|
Back to top |
|
|
venosol Warnings : 1 New User
Joined: 16 Nov 2006 Posts: 43 Location: Bangalore
|
|
|
|
agkshirsagar wrote: |
Instead of asking this on forum, why dont you give it a try yourself? |
Ofcourse Ekta,
I will do that. But I am beginner in Mainframes. I thought of asking the correct syntax before doing myself because its a new thing.
thnx |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Funny answer to funny question...
O. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
I will do that. But I am beginner in Mainframes. I thought of asking the correct syntax before doing myself because its a new thing. |
You should not ask syntax, instead refer the manual first.
Try yourself first,if problem comes then ask on the forum, we are always there for help. With this approach you will learn fast.
Quote: |
Can we use if conditions in Display statement. If so how? |
By the way, can you name one language which supports this? |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
dBaseIII, which I've used in the FoxBase and FoxPro implementations, allows an "immediate if"; e.g.,:
a = b + iif(<cond>,c,d)
where if <cond> is true, the iif(...) value = c, else = d.
A very nice feature indeed. |
|
Back to top |
|
|
|