Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can we use if conditions in Display statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Can we use if conditions in Display statement
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: 1187
Location: Bangalore,India

PostPosted: Thu Mar 22, 2007 12:19 pm    Post subject:
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    Post subject: Display statement
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: 1187
Location: Bangalore,India

PostPosted: Thu Mar 22, 2007 12:45 pm    Post subject:
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    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Thu Mar 22, 2007 1:17 pm    Post subject:
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    Post subject:
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: 685
Location: Earth

PostPosted: Thu Mar 22, 2007 2:59 pm    Post subject:
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    Post subject:
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: 2360
Location: Israel

PostPosted: Thu Mar 22, 2007 3:12 pm    Post subject:
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: 685
Location: Earth

PostPosted: Thu Mar 22, 2007 4:09 pm    Post subject:
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

Active Member


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

PostPosted: Thu Mar 22, 2007 5:37 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us