Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 95927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:44:05+00:00 2026-05-10T23:44:05+00:00

I have been tasked with creating a program that will generate an amortization schedule.

  • 0

I have been tasked with creating a program that will generate an amortization schedule. I have only done a bit of research so far, but I need to calculate out payments, interest per payment and principal per payment. Can any one point me in the right direction to figure this out? While I will be writing this in RPG, I am sure others could make use of this algorithm in the future.

(Update) Okay, so how do I calculate based on a 365 day year?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:44:06+00:00Added an answer on May 10, 2026 at 11:44 pm

    Here is what I ended up creating. I have posted the whole test program. It is written in RPG, but should be easily be figured out for any other languages.

     H ActGrp(*caller) BndDir('MODULES') DftActGrp(*no)    //*********************************************************************    // Program . . . . . AMORT    //*********************************************************************    // Printer/Display Files  FAMORTDF   CF   E             WORKSTN sfile(SFL01:rrn01)    //*********************************************************************    // Named Constants   /copy modules/qcopysrc,statuscopy     // Named Indicators  D indicatorPtr    S               *   Inz(%Addr(*IN))  D                 DS                  Based(IndicatorPtr)   /copy modules/qcopysrc,scrncopy     // Subfile  Fields  D rrn01           S              4P 0 inz(0)     //*********************************************************************    // Misc Fields  D* Monthly Payment  D m               S             12P 2          D* Principal  D p               S             12P 2                                        D* Interest  D i               S              5P 3                                        D* Length (in Years)  D l               S              3P 0                                        D* Monthly Interest  D j               S             10P10                                        D* # of Months  D n               S              5P 0                                        D* Current Monthly Int.  D h               S             12P 2                                        D* Current Principal  D c               S             12P 2                                        D* New Balance  D q               S             12P 2                                           //*********************************************************************    // External Program Procedures     // Internal Subprocedures  D Init            PR  D Main            PR  D SubfileFilled   PR              N  D ClearScreen     PR  D IsValidData     PR              N  D LoanPayment     PR            12P 2  D  principal                    12P 2  D  interest                      5P 3  D  loanPeriod                    3P 0  D  paymentsYear                  3P 0     // External Subprocedures    ///copy modules/qsrvsrc,p.string     //*********************************************************************    // Entry Parms  D AMORT           PR                  extpgm('AMORT')  D AMORT           PI    //*********************************************************************   /free    Init();    Main();     *inlr = *on;   /end-free   P*--------------------------------------------------  P* Procedure name: Init  P* Purpose:  P* Returns:  P*--------------------------------------------------  P Init            B  D Init            PI    /free     pgm = 'AMORT';    sflDsp = *off;     return;    /end-free  P Init            E    P*--------------------------------------------------  P* Procedure name: Main  P* Purpose:  P* Returns:  P*--------------------------------------------------  P Main            B  D Main            PI    /free     dow (not F3) and (not F12);       write OVR01;      exfmt CTL01;      ClearScreen();       if (IsValidData()) and (not F3) and (not F12);         // Fill the header information        dPayment = LoanPayment(dLoanAmt:dIntRate:dLoanPrd:dPayYear);        dNumPaymnt = dLoanPrd * dPayYear;        m = dPayment + dExtraPay;        p = dLoanAmt;        q = p;         // Fill the table        if (SubfileFilled());          sflDsp = *on;        endif;      endif;     enddo;     return;    /end-free  P Main            E    P*--------------------------------------------------  P* Procedure name: SubfileFilled  P* Purpose: Fill the subfile  P* Returns:  P*--------------------------------------------------  P SubfileFilled   B  D SubfileFilled   PI              N   D isFilled        S               N  D x               S              4P 0  D intCume         S             12P 2  D extraPayCume    S             12P 2  D payDate         S               D  D payment         S             12P 2  D extraPayment    S             12P 2    /free     isFilled = *on;     sflClear = *on;    write CTL01;    sflClear = *off;    rrn01 = 0;    x = 0;     // Setup the work fields    payment = dPayment;    extraPayment = dExtraPay;    payDate = dStartDate;     // Create records until there is a zero balance    dow (q > 0);       x += 1;      eval(h) h = p * j; // Monthly Interest       // Adjust for final payment      if (p < m);        m = p + h;        payment = p;        extraPayment = h;      endif;       // Calulate Principal      c = m - h;      // Calulate the new balance      q = p - c;       // Accumulate the interest and extra payments      intCume += h;      extraPayCume += extraPayment;       // Determine the next pay date      select;        when dTerms = '1'; //Yearly          payDate += %years(1);        when dTerms = '2'; //Semi-Annual          payDate += %months(6);        when dTerms = '3'; //Quarterly          payDate += %months(3);        when dTerms = '4'; //Monthly          payDate += %months(1);        when dTerms = '5'; //Bi-Weekly          payDate += %days(14);      endsl;       // Fill the subfile      sPayNum = x;      sPayDate = payDate;      sBegBal = p;      sSchedPay = payment;      sExtraPay = extraPayment;      sTotPay = m;      sInterest = h;      sPrincipal = c;      sEndBal = q;      sCumeInt = intCume;       // Move the End balance to the beginning balance      p = q;       rrn01 += 1;      write SFL01;     enddo;     // Return the calculated information to the header    dActPaymnt = x;    dTotInt = intCume;    dTotEPay = extraPayCume;     if (rrn01 < 1);      isFilled = *off;    endif;     return isFilled;    /end-free  P SubfileFilled   E    P*--------------------------------------------------  P* Procedure name: ClearScreen  P* Purpose:  P* Returns:  P*--------------------------------------------------  P ClearScreen     B  D ClearScreen     PI    /free     c = 0;    h = 0;    i = 0;    j = 0;    l = 0;    m = 0;    n = 0;    p = 0;    q = 0;    dPayment = 0;    dNumPaymnt = 0;    dActPaymnt = 0;    dTotEPay = 0;    dTotInt = 0;     return;    /end-free  P ClearScreen     E    P*--------------------------------------------------  P* Procedure name: IsValidData  P* Purpose: Validate the data on the screen  P* Returns: True or False  P*--------------------------------------------------  P IsValidData     B  D IsValidData     PI              N   D isValid         S               N    /free     if (dLoanAmt <> 0) and (dIntRate <> 0) and (dLoanPrd <> 0) and       (dPayYear <> 0) and (dStartDate <> %date('0001-01-01'));      isValid = *on;    else;      isValid = *off;    endif;     return isValid;    /end-free  P IsValidData     E    P*--------------------------------------------------  P* Procedure name: LoanPayment  P* Purpose: Calculates the payment  P* Returns:  P*--------------------------------------------------  P LoanPayment     B  D LoanPayment     PI            12P 2  D  principal                    12P 2  D  interest                      5P 3  D  loanPeriod                    3P 0  D  paymentsYear                  3P 0   D retMonthlyPayment...  D                 S             12P 2    /free     eval(h) n = loanPeriod * paymentsYear;    eval(h) j = interest / (paymentsYear * 100);     eval(h) m = principal * (j / (1 - (1 + j) ** -n));     return m;    /end-free  P LoanPayment     E 

    This code has been tested against our loan calculator. If test vs. Excel, it was off about 32 cents on a $200,000 loan. I am sure that is do to rounding issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I am not quite sure what you mean by "host… May 11, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer You can use xlrd. From its documentation, you can read… May 11, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer My own app (Task Coach) was built for 2.2.1 (on… May 11, 2026 at 11:53 pm

Related Questions

I have been tasked with creating a program what will create take files in
I've been tasked with creating some shortcuts to the desktop when our app installs.
I've been tasked (by my wife) with creating a program to allow her to
I have been tasked with creating a reusable process for our Finance Dept to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.