View previous topic :: View next topic |
Author |
Message |
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Fri Jun 18, 2004 7:28 am Post subject: Even number Check in Easytrieve |
|
|
Hi ,
Do we've a divide statement in EZT like in cobol.I want to find whether a numeric field is even or not in EZT .
Thanks,
Vijay |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Fri Jun 18, 2004 8:23 am Post subject: |
|
|
Vijay,
Please use meaningful topic titles. A more approriate title would be "Even number Check in Easytrieve" . I am editing the topic title.
There is no divide verb in easytrieve but you can use the divide symbol "/" to divide a number. The following program will check if the number is an even number or not
Code: |
DEFINE W-NUMBER W 05 N 0
DEFINE W-QUOTIENT W 05 N 0
DEFINE W-REMAINDER W 05 N 0
JOB INPUT NULL
W-NUMBER = 101
W-QUOTIENT = W-NUMBER / 2
W-REMAINDER = (W-NUMBER - (W-QUOTIENT * 2 ))
IF W-REMAINDER = 0
DISPLAY 'THE NUMBER IS EVEN '
ELSE
DISPLAY 'THE NUMBER IS NOT EVEN '
END-IF
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|