Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
renzreny

New User

Joined: 16 Oct 2008
Posts: 7
Location: USA

 Posted: Tue Nov 25, 2008 8:11 pm    Post subject: Divison by a decimal point numbers Hello, I've come across a scenario where I'd need to divide a number by 365.25 in assembler. Let's say we've a variable VARA that will have values ranges from 0 - 36525. I'd need to divide VARA by 365.25. Quotient part of the result is needed to do further processing of my logic. Note that dividend will always be a numeric number and only divisor has the fractional part Please help me lead to the solution for the same. Please advise me incase additional informations needed. Thanks, reny

Robert Sample

Global Moderator

Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

 Posted: Tue Nov 25, 2008 8:17 pm    Post subject: Review the floating point instructions in HLASM.
enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10327
Location: italy

 Posted: Tue Nov 25, 2008 8:50 pm    Post subject: Reply to: Divison by a decimal point numbers if You are trying to carry on date conversions check the CBT tape for working programs anyway no need to use floating points for date calculations, for packed decimal You have to carry on Your own virtual decimal point handling
renzreny

New User

Joined: 16 Oct 2008
Posts: 7
Location: USA

 Posted: Tue Nov 25, 2008 9:13 pm    Post subject: Yes...I was actually using it for "age calculation logic". Here the scenario is to calculate the age when birthdate is given. What I've thought to achieve is (logic in highlevel) .... TODAYDATE = (Current Year * 365) + (Current Month in days) + (Current Day) BIRTHDATE = (B'day year * 365)+ (B'day month in days)+ (day) AGE is calculated as (TODAYDATE - BIRTHDATE) / 365 The results are nearly okay. But it will not be perfect always as leapyear is not taking care. In googling, I got to understand that if 365.25 days are used (instead of 365) in above calculation, result will be almost accurate. Please advise me whether there is any better way to accomplish this to calculate age when b'day is given. It would be grateful if anyone has sample handy. Thanks in advance.
enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10327
Location: italy

 Posted: Tue Nov 25, 2008 10:43 pm    Post subject: Reply to: Divison by a decimal point numbers again check the cbttape for ready to run code http://www.cbttape.org
renzreny

New User

Joined: 16 Oct 2008
Posts: 7
Location: USA

 Posted: Wed Nov 26, 2008 6:54 pm    Post subject: Thanks you so much enrico-sorichetti!!. You directed me to the right place where I've got it resolved.... It was just a matter of plug-in and play (with minor enhancements) Thanks, renz
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us