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

Obtaining Remainder and quotient using eztrieve


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Anu Narayanan

New User


Joined: 12 Sep 2005
Posts: 20
Location: USA

PostPosted: Mon Aug 28, 2006 11:06 pm
Reply with quote

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

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Tue Aug 29, 2006 3:28 pm
Reply with quote

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

New User


Joined: 18 Jul 2006
Posts: 7
Location: USA

PostPosted: Tue Sep 19, 2006 6:48 pm
Reply with quote

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
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 -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts How to get the remainder and quotient... DFSORT/ICETOOL 2
No new posts Obtaining file information COBOL Programming 25
No new posts Obtaining a signed value when updatin... DFSORT/ICETOOL 2
No new posts Obtaining the address of Pointer in C... COBOL Programming 7
No new posts Please Help me How to achieve in reco... CA Products 5
Search our Forums:

Back to Top