View previous topic :: View next topic
|
Author |
Message |
Anu Narayanan
New User
Joined: 12 Sep 2005 Posts: 20 Location: USA
|
|
|
|
Hi,
Is there a way to obtain a remainder during a divide statement using eztrieve like we have in Cobol or any other language? I am trying to find whether a year is leap year and hence further calculation goes on. |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
Try using the INTEGER function which drops any fraction from a number
ie
RESULT W 5 N 2
TESTIT W 5 N 2
code
RESULT = YEAR/4
TESTIT INTEGER = RESULT
IF RESULT = TESTIT then you have a leap year
ELSE you don't have a leap year
ENDIF |
|
Back to top |
|
|
vijayarockiarajkp
New User
Joined: 18 Jul 2006 Posts: 7 Location: USA
|
|
|
|
Hi,
Please find the below code i believe it will work
FILE FILE1
YEAR1 1 4 N
*
FILE FILE2
YEAR2 1 4 N
LEAP 6 11 A
*
WS-LEAP W 10 A VALUE 'LEAPYEAR'
WS-NLEAP W 11 A VALUE 'NOTLEAPYEAR'
WS-QUOTE W 4 N
WS-QUOTE1 W 4 N
WS-REM W 4 N
*
*
JOB INPUT ( FILE1 )
*
WS-QUOTE = YEAR1 / 4
WS-QUOTE1 = WS-QUOTE * 4
IF WS-QUOTE1 = YEAR1
YEAR2 = YEAR1
LEAP = WS-LEAP
ELSE
YEAR2 = YEAR1
LEAP = WS-NLEAP
END-IF
PUT FILE2
* |
|
Back to top |
|
|
|