SoftwareMining - Business Rule Extraction and Documentation 

Business Rule  
REPORT2.CBL
COBOL Documentation
REPORT2.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
/**
 * a000MainControl_M310
 */

public void a000MainControl_M310 (){
  if (ACMUtil.compare(iData.getAns(), "N") == 0) {
    stop();
  }
  perform("a100LoadData_M350");
  weeklyReport.initiate();
  //  Set the date to last month 
  iData.setTrDate(new ACMDate());
  if (iData.getTrDate().getMonth() > 1) {
    iData.getTrDate().setMonth(iData.getTrDate().getMonth() - 1);
  } else {
    iData.getTrDate().setYear(iData.getTrDate().getYear() - 1);
    iData.getTrDate().setMonth(12);
  }
  //  set the day to 20th (we are going to report on last week of mont 
  iData.getTrDate().setDay(20);

  for (int i = 0; i < 5; i++ ){
    perform("a010ProduceWeeklyReport_M320");
  }
  weeklyReport.terminate();
  stop();
}


/**
 * a010ProduceWeeklyReport_M320
 */

public void a010ProduceWeeklyReport_M320 (){
  iData.getTrDate().setDay(iData.getTrDate().getDay() + 1);
  display("Day no:" + iData.getTrDate().getDay());

  // initialize loop variable 
  iData.setWsAgentCounter(100);

  while ( true ){
    // termination condition 
    if(iData.getWsAgentCounter().getAsInt() == 110)
      break;

    perform("a020ProduceAgentReport_M330");

    // increment loop variable 
    iData.setWsAgentCounter(iData.getWsAgentCounter().getAsInt() + 1);
  }
}


/**
 * a020ProduceAgentReport_M330
 */

public void a020ProduceAgentReport_M330 (){
  //    get next agent number - this is almost a random 
  //    number generator 
  // COBOL String Command 
  ACMStringProcessor.process(iData.getField("agentId"),
    new String[] {"AG", iData.getWsAgentCounter().getAsStringFormatted()},
    new String[] {"", ""}
  );

  //    Initilize 
  //    MOVE 0 TO agent-liabilities. 

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

  while ( true ){
    // termination condition 
    if(iData.getWsCusipCounter().getAsInt() == 20)
      break;

    perform("a030CusipReport_M340");

    // increment loop variable 
    iData.setWsCusipCounter(iData.getWsCusipCounter().getAsInt() + 1);
  }
}


/**
 * a030CusipReport_M340
 */

public void a030CusipReport_M340 (){
  iData.setCusipData(iData.getDCusipData(iData.getWsCusipCounter().getAsInt() - 1).getAsString());
  iData.setWsTime(new ACMTime());
  iData.setQty(100 * iData.getWsTime().getMilliSecs());
  if (iData.getWsTime().getMilliSecs() > 90) {
    iData.setSalesPrice(iData.getPrice().getAsDouble() * iData.getQty().getAsDouble());
    iData.setPurchasePrice(0.0);
  } else if (iData.getWsTime().getMilliSecs() > 80) {
      iData.setPurchasePrice(iData.getPrice().getAsDouble() * iData.getQty().getAsDouble());
      iData.setSalesPrice(0.0);
    } else if (iData.getWsTime().getMilliSecs() > 70) {
        iData.setSalesPrice(iData.getPrice().getAsDouble() * iData.getQty().getAsDouble());
        iData.setPurchasePrice(0.0);
      } else if (iData.getWsTime().getMilliSecs() > 60) {
          iData.setSalesPrice(iData.getPrice().getAsDouble() * iData.getQty().getAsDouble());
          iData.setPurchasePrice(0.0);
        } else if (iData.getWsTime().getMilliSecs() > 50) {
            iData.setPurchasePrice(0.0);
            iData.setSalesPrice(0.0);
          } else if (iData.getWsTime().getMilliSecs() > 40) {
              iData.setPurchasePrice(iData.getPrice().getAsDouble() * iData.getQty().getAsDouble());
              iData.setSalesPrice(0.0);
            } else if (iData.getWsTime().getMilliSecs() > 30) {
                iData.setSalesPrice(iData.getPrice().getAsDouble() * iData.getQty().getAsDouble());
                iData.setPurchasePrice(0.0);
              } else if (iData.getWsTime().getMilliSecs() > 20) {
                  iData.setPurchasePrice(iData.getPrice().getAsDouble() * iData.getQty().getAsDouble());
                  iData.setSalesPrice(0.0);
                } else {
                  iData.setSalesPrice(iData.getPrice().getAsDouble() * iData.getQty().getAsDouble());
                  iData.setPurchasePrice(0.0);
                }
  //    ADD purchase-price TO agent-liabilities. 
  //    ADD sales-price    TO agent-liabilities. 
  iData.setWsLiability(iData.getSalesPrice().getAsDouble() - iData.getPurchasePrice().getAsDouble());
  weeklyReport.generate("reportLine");
}

//  DISPLAY "     WS-LIABILITY : " WS-LIABILITY. 

/**
 * a100LoadData_M350
 */

public void a100LoadData_M350 (){
  //       "123456789012345678901234567890123456789012345" 
  //       "<-CUSIP--><----Prod Name--->99999" 
  iData.getDCusipData(0).setValue("023477332 ACME Financials   28334");
  iData.getDCusipData(1).setValue("234523366 ACME & ACME       08325");
  iData.getDCusipData(2).setValue("052345002 ACME Clubs        24311");
  iData.getDCusipData(3).setValue("123413312 ACME Hotel Group  01902");
  iData.getDCusipData(4).setValue("037283892 ACME Superstores  02336");
  iData.getDCusipData(5).setValue("92830973  ACME Travel Insur.34165");
  iData.getDCusipData(6).setValue("992839973 ACME Novelties    34212");
  iData.getDCusipData(7).setValue("091828176 ACME Insurance    26212");
  iData.getDCusipData(8).setValue("642987110 ACME Trave1       09999");
  iData.getDCusipData(9).setValue("073920933 ACME Metals       35714");
  iData.getDCusipData(10).setValue("3942-8784 ACME Stee1        13224");
  iData.getDCusipData(11).setValue("582939200 ACME HealthCare   21204");
  iData.getDCusipData(12).setValue("C93728733 ACME FastFood     05000");
  iData.getDCusipData(13).setValue("D81778172 ACME Cola         10025");
  iData.getDCusipData(14).setValue("034568005 ACME Bank         02399");
  iData.getDCusipData(15).setValue("734563777 ACME Investments  33030");
  iData.getDCusipData(16).setValue("034563466 ACME Industries   01866");
  iData.getDCusipData(17).setValue("0f7382973 ACME Airways      09214");
  iData.getDCusipData(18).setValue("0s9823792 ACME Clinics      22012");
  iData.getDCusipData(19).setValue("84567456y ACME Stores       02211");
}