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

Can we use if conditions in Display statement


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

New User


Joined: 16 Nov 2006
Posts: 43
Location: Bangalore

PostPosted: Thu Mar 22, 2007 12:18 pm
Reply with quote

Can we use if conditions in Display statement. If so how?


thanx.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Mar 22, 2007 12:19 pm
Reply with quote

Hi There,

What do u mean by that?
Would you please restate ur query?
Back to top
View user's profile Send private message
venosol
Warnings : 1

New User


Joined: 16 Nov 2006
Posts: 43
Location: Bangalore

PostPosted: Thu Mar 22, 2007 12:38 pm
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Mar 22, 2007 12:45 pm
Reply with quote

Hi There,

Again i am not able to understand
Back to top
View user's profile Send private message
venosol
Warnings : 1

New User


Joined: 16 Nov 2006
Posts: 43
Location: Bangalore

PostPosted: Thu Mar 22, 2007 1:05 pm
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Mar 22, 2007 1:17 pm
Reply with quote

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
View user's profile Send private message
venosol
Warnings : 1

New User


Joined: 16 Nov 2006
Posts: 43
Location: Bangalore

PostPosted: Thu Mar 22, 2007 1:20 pm
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Mar 22, 2007 2:59 pm
Reply with quote

Instead of asking this on forum, why dont you give it a try yourself?
Back to top
View user's profile Send private message
venosol
Warnings : 1

New User


Joined: 16 Nov 2006
Posts: 43
Location: Bangalore

PostPosted: Thu Mar 22, 2007 3:07 pm
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Thu Mar 22, 2007 3:12 pm
Reply with quote

Funny answer to funny question...

O.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Mar 22, 2007 4:09 pm
Reply with quote

icon_biggrin.gif
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. icon_smile.gif 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? icon_lol.gif
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


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

PostPosted: Thu Mar 22, 2007 5:37 pm
Reply with quote

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
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 How to load to DB2 with column level ... DB2 6
No new posts Db2 SQL - how to switch among differe... DB2 18
No new posts To search DB2 table based on Conditio... DB2 1
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts How to display the leading zeros of a... DB2 7
Search our Forums:

Back to Top