SoftwareMining - Business Rule Extraction and Documentation 

Business Rule  
PRD_CALL.CBL
COBOL Documentation
PRD_CALL.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
// =========================================================== 
// === SECTION mainx_M710 
// =========================================================== 


/**
 * mainx_M710
 */

public void mainx_M710 (){
}


/**
 * c000Main_M720
 */

public void c000Main_M720 (){
  //  INITIALIZE THE DATA 
  //           ID-Desc----- Color-----SizQtyPrice----   
  //           12345678901234567890123456789012345" 
  iData.getWd(0).setValue("001Pencil    Black     010000   170");
  iData.getWd(1).setValue("002Ruler     White     010000  0200");
  iData.getWd(2).setValue("003CD-R      Gold      010000  0899");
  iData.getWd(3).setValue("004Printer               1 00 19999");
  iData.getWd(4).setValue("005Toner     Black       1  0  8900");
  iData.getWd(5).setValue("006Toner     Red         1  0  9900");
  iData.getWd(6).setValue("007Paper     White       5  0  2570");
  iData.getWd(7).setValue("0083.5 FloppyBlue       10  0  1099");
  iData.getWd(8).setValue("009Envelopes White     100  0  2699");
  iData.getWd(9).setValue("01012xCD ROM Grey        1  0  1299");

  while ( true ){
    // termination condition 
    if(ACMUtil.ACMCheck88Vars(iData.getWsEntry(), iData.wsEntryWsTerminate))
      break;

    //  CALCULATE THE ORDER VALUE 
    performThru("getTotalValue_M730", "c010GetTotalExit_M750");
    //  DISPLAY THE ORDER VALUE + GET USER CHOICE 
    performThru("displayChoices_M830", "dispSec02_M850");
    //  GET USER CHOICE 
    //  CHECK THE USER ENTRY 
    if (ACMUtil.ACMCheck88Vars(iData.getWsEntry(), iData.wsEntryWsNext)) {
      performThru("readNextProduct_M760", "c030ReadExit_M800");
    } else if (ACMUtil.ACMCheck88Vars(iData.getWsEntry(), iData.wsEntryWsAgain)) {
        iData.setWsIdx(0);
        performThru("readNextProduct_M760", "c030ReadExit_M800");
      } else if (ACMUtil.ACMCheck88Vars(iData.getWsEntry(), iData.wsEntryWsTerminate)) {
          ; // continue
        } else {
          performThru("invalidOption_M810", "invalidSect1_M820");
        }
  }
  stop();
}

// =========================================================== 
// === SECTION getTotalValue_M730 
// =========================================================== 


/**
 * getTotalValue_M730
 */

public void getTotalValue_M730 (){
  //  NOTE NEXT ROUTINE NAME IS STARTING WITH '0' - 
}


/**
 * c000GetTotal_M740
 */

public void c000GetTotal_M740 (){
  iData.setWsTotalValue(0.0);
  //  CALCULATE THE TOTAL ORDER VALUE 

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

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

    iData.setWsTemp(iData.getWd(iData.getI().getAsInt() - 1).getAsString());
    product.setProductInfo(iData.getWsTempValue());
    iData.setWsTotalValue(iData.getWsTotalValue().getAsDouble() + (product.getProdQty().getAsDouble() * product.getProdPrice().getAsDouble()));
    iData.setWsMiscWsTotal(iData.getWsTotalValue());

    // increment loop variable 
    iData.setI(iData.getI().getAsInt() + 1);
  }
}


/**
 * c010GetTotalExit_M750
 */

public void c010GetTotalExit_M750 (){
}

// =========================================================== 
// === SECTION readNextProduct_M760 
// =========================================================== 


/**
 * readNextProduct_M760
 */

public void readNextProduct_M760 (){
}


/**
 * c000ReadIncrementIndex_M770
 */

public void c000ReadIncrementIndex_M770 (){
  iData.setWsIdx(iData.getWsIdxValue() + 1);
  if (iData.getWsIdx().getAsInt() == 10) {
    iData.setWsIdx(1);
  }
}


/**
 * c010ReadMove_M780
 */

public void c010ReadMove_M780 (){
  iData.setWsTemp(iData.getWd(iData.getWsIdx().getAsInt() - 1).getAsString());
  product.setProductInfo(iData.getWsTempValue());
}


/**
 * c020ReadCall_M790
 */

public void c020ReadCall_M790 (){

  BaseService prdViewBS;
  prdViewBS = ServicesFactory.create("com.softwaremining.examples.product.PrdView", this);
  prdViewBS.execute(product.getProductInfo());

  ServicesFactory.cancelService("com.softwaremining.examples.product.PrdView");
  iData.getWd(iData.getWsIdx().getAsInt() - 1).setValue(product.getProductInfoValue());
}


/**
 * c030ReadExit_M800
 */

public void c030ReadExit_M800 (){
}

// =========================================================== 
// === SECTION invalidOption_M810 
// =========================================================== 


/**
 * invalidOption_M810
 */

public void invalidOption_M810 (){
}


/**
 * invalidSect1_M820
 */

public void invalidSect1_M820 (){
  iData.setWsErrMess("Invalid Option, Please Try again");
  performThru("displayError_M860", "c002DisplayError_M880");
}

// =========================================================== 
// === SECTION displayChoices_M830 
// =========================================================== 


/**
 * displayChoices_M830
 */

public void displayChoices_M830 (){
}


/**
 * dispSec01_M840
 */

public void dispSec01_M840 (){
  iData.setWsErrMess("Entry ext , tart again , xit");
  performThru("displayError_M860", "c002DisplayError_M880");
}


/**
 * dispSec02_M850
 */

public void dispSec02_M850 (){
}

// =========================================================== 
// === SECTION displayError_M860 
// =========================================================== 


/**
 * displayError_M860
 */

public void displayError_M860 (){
}


/**
 * c001DisplayError_M870
 */

public void c001DisplayError_M870 (){
}


/**
 * c002DisplayError_M880
 */

public void c002DisplayError_M880 (){
}