Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

if condition

Former Member
0 Kudos

can u help to write an if conditoin

3 REPLIES 3

Former Member
0 Kudos

if var1 EQ val.

[statements]

endif.

data var type i value 10.

if var EQ 10.

WRITE 'var is 10'.

else.

WRITE 'var is not 10'.

endif.

Ps: Reward points if useful.

Former Member
0 Kudos

****try this snippet*************

data: salary type i value 199990.

if salary < 200000.

write 'salary must be increased'.

endif.

**********read the follwoing doc*************

IF

Basic form

IF logexp.

Effect

Used for case distinction.

Depending on whether the logical expression logexp is true or not, this statement triggers the execution of various sections of code enclosed by IF and ENDIF.

There are three different types:

IF logexp.

processing1

ENDIF.

If the logical expression is true, processing1 is executed. Otherwise, the program resumes immediately after ENDIF.

IF logexp.

processing1

ELSE.

processing2

ENDIF.

If the logical expression is true, processing1 is executed. Otherwise, processing2 is executed (see ELSE).

IF logexp1.

processing1

ELSEIF logexp2.

processing2

ELSEIF ...

...

ELSE.

processingN

ENDIF.

If the logexp1 is false, logexp2 is evaluated and so on. You can use any number of ELSEIF statements. If an ELSE statement exists, it always appears after all the ELSEIF statements.

Notes

All IF statements must be concluded in the same processing block by ENDIF.

IF statements can be nested as many times as you like.

The IF statement does not directly affect the selection. For this purpose, you should use the CHECK statement.

former_member188685
Active Contributor
0 Kudos

Hi Suresh,


data: a(1) type c.

if a is initial .

"do some thing..
else.
"do something.

endif.

if a = ' '.

"do some thing..
else if a = 'X'.
"do something.

endif.

regards

vijay