SoftwareMining - Business Rule Extraction and Documentation 

Business Rule  
LOAN.CBL
COBOL Documentation
LOAN.html
Persistent Records:
Signature (From Linkage Section) 
Working Storage Section

 

Analyst's Description/Comments
Data Filters Applied to this rule:
  • None
Statement Category Filters:
  • Screen statements

Business Rule Code
/**
 * main_M910
 */

public void main_M910 (){
  //   - 
  //  CLEAR SCREEN AND READ DATA 
  //   - 
  if (iData.getLoanLength().getAsInt() > 4) {
    iData.setStartYear(iData.getLoanLengthValue() - 4);
  } else {
    iData.setStartYear(0);
  }
  if (iData.getInterestRate().getAsDouble() > 0.4) {
    iData.setStartInterest(iData.getInterestRate().getAsDouble() - 0.4);
  } else {
    iData.setStartInterest(0.0);
  }
  iData.setYearRow(1);
  //   - 
  //  GO THRU THE NUMBER OF YEARS 
  //   - 
  iData.getDspNoYrs(0).setValue("% Rate->");
  iData.setNextYear(iData.getStartYear());

  // initialize loop variable 
  iData.setYearRow(2);

  while ( true ){
    // termination condition 
    if(iData.getYearRow().getAsInt() == 11)
      break;

    // COBOL String Command 
    ACMStringProcessor.process(iData.getDspNoYrs(iData.getYearRowValue()-1), 
      new String[] {iData.getNextYear().getAsStringFormatted(), " Yrs:"},
      new String[] {"", ""}
    );

    perform("doNextRow_M920");
    iData.setNextYear(iData.getNextYear().getAsInt() + 1);

    // increment loop variable 
    iData.setYearRow(iData.getYearRow().getAsInt() + 1);
  }
  //   - 
  //   - FINALLY DISPLAY THE RESULTS 
  //   - 
  //   - 
  //   - WAIT FOR KEYBOARD RETURN 
  //   - 
  //   - 
  //   AND EXIT 
  //   - 
  stop();
}


/**
 * doNextRow_M920
 */

public void doNextRow_M920 (){
  iData.setNextInterest(iData.getStartInterest());

  // initialize loop variable 
  iData.setInterestCol(1);

  while ( true ){
    // termination condition 
    if(iData.getInterestCol().getAsInt() == 10)
      break;

    iData.getDspResult(0, iData.getInterestCol().getAsInt() - 1).setValue(iData.getNextInterest());
    perform("calculate_M930");
    iData.getDspResult(iData.getYearRow().getAsInt() - 1, iData.getInterestCol().getAsInt() - 1).setValue(iData.getNextResult());
    iData.setNextInterest(iData.getNextInterest().getAsDouble() + 0.1);

    // increment loop variable 
    iData.setInterestCol(iData.getInterestCol().getAsInt() + 1);
  }
}


/**
 * calculate_M930
 */

public void calculate_M930 (){
  iData.setIntdec(iData.getNextInterest().getAsDouble() / (12.0 * 100.0));
  iData.setNummonths(iData.getNextYearValue() * 12);
  iData.setNextResult(iData.getPrincipal().getAsDouble() * (iData.getIntdec().getAsDouble() / (1.0 - (Math.pow((1.0 + iData.getIntdec().getAsDouble()), - iData.getNummonthsValue())))));
}