SoftwareMining - Business Rule Extraction and Documentation 

Business Rule  
PRD_CALL2.CBL
COBOL Documentation
PRD_CALL2.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 main_M360 
// =========================================================== 


/**
 * main_M360
 */

public void main_M360 (){
}


/**
 * mainOpenFile_M370
 */

public void mainOpenFile_M370 (){
  productFile.open(ACMBasePersistence.OPEN_MODE_I_O);
  performThru("openProductFile_M410", "openProductFileEnd_M430");
  iData.setWsEntry("N");
  // goto mainUserChoice_M380; 
  _goto("mainUserChoice_M380");
}


/**
 * mainUserChoice_M380
 */

public void mainUserChoice_M380 (){

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

    //  GET USER CHOICE 
    performThru("displayChoices_M620", "displayChoicesEnd_M640");
    //  CHECK THE USER ENTRY 
    if (ACMUtil.ACMCheck88Vars(iData.getWsEntry(), iData.wsEntryWsNext)) {
      performThru("readNextProduct_M500", "readNextProductEnd_M540");
    } else if (ACMUtil.ACMCheck88Vars(iData.getWsEntry(), iData.wsEntryWsAgain)) {
        performThru("readFirstProduct_M470", "readFirstProductEnd_M490");
      } else if (ACMUtil.ACMCheck88Vars(iData.getWsEntry(), iData.wsEntryWsPrint)) {
          performThru("printProductList_M550", "printProductListEnd_M580");
        } else if (ACMUtil.ACMCheck88Vars(iData.getWsEntry(), iData.wsEntryWsTerminate)) {
            ; // continue
          } else {
            performThru("invalidOption_M590", "invalidOptionEnd_M610");
          }
  }
}


/**
 * mainCloseFile_M390
 */

public void mainCloseFile_M390 (){
  productFile.close();
}


/**
 * mainEnd_M400
 */

public void mainEnd_M400 (){
  stop();
}

// =========================================================== 
// === SECTION openProductFile_M410 
// =========================================================== 


/**
 * openProductFile_M410
 */

public void openProductFile_M410 (){
}


/**
 * openProductFile10_M420
 */

public void openProductFile10_M420 (){
  productFile.setFdProdId(0);

  // START statement 
  try {
    productFile.seek(productFile.getFdProdId(), ACMBasePersistence.CONDITION_TYPE_GREATER);
  } catch (InvalidKeyException e){
    iData.setWsErrMess("Could not open the PRODUCT file");
    performThru("displayError_M650", "displayErrorEnd_M670");
    stop();
  }
}


/**
 * openProductFileEnd_M430
 */

public void openProductFileEnd_M430 (){
}

// =========================================================== 
// === SECTION initPrd_M440 
// =========================================================== 


/**
 * initPrd_M440
 */

public void initPrd_M440 (){
}


/**
 * initPrd10_M450
 */

public void initPrd10_M450 (){
  // INITIALIZE 
  ACMInitialize.initialize(productFile.getFdProductInfo());
}


/**
 * initPrdEnd_M460
 */

public void initPrdEnd_M460 (){
}

// =========================================================== 
// === SECTION readFirstProduct_M470 
// =========================================================== 


/**
 * readFirstProduct_M470
 */

public void readFirstProduct_M470 (){
}


/**
 * readFirstProduct10_M480
 */

public void readFirstProduct10_M480 (){
  performThru("openProductFile_M410", "openProductFileEnd_M430");
  performThru("readNextProduct_M500", "readNextProductEnd_M540");
}


/**
 * readFirstProductEnd_M490
 */

public void readFirstProductEnd_M490 (){
}

// =========================================================== 
// === SECTION readNextProduct_M500 
// =========================================================== 


/**
 * readNextProduct_M500
 */

public void readNextProduct_M500 (){
}


/**
 * readNextProduct10_M510
 */

public void readNextProduct10_M510 (){

  // READ statement 
  try {
    productFile.next();
  } catch (AtEndException  e){
    performThru("readFirstProduct_M470", "readFirstProductEnd_M490");
  }
  prdInfo.setProductInfo(productFile.getFdProductInfoValue());
}


/**
 * readNextProduct20_M520
 */

public void readNextProduct20_M520 (){

  BaseService prdView2BS;
  prdView2BS = ServicesFactory.create("com.softwaremining.examples.product2.PrdView2", this);
  prdView2BS.execute(prdInfo.getProductInfo());

  ServicesFactory.cancelService("com.softwaremining.examples.product2.PrdView2");
  productFile.setFdProductInfo(prdInfo.getProductInfoValue());
}


/**
 * readNextProduct30_M530
 */

public void readNextProduct30_M530 (){

  // REWRITE statement 
  try {
    productFile.update();
  } catch (InvalidKeyException e){
    iData.setWsErrMess("Could not write to the PRODUCT file");
    performThru("displayError_M650", "displayErrorEnd_M670");
  }
}


/**
 * readNextProductEnd_M540
 */

public void readNextProductEnd_M540 (){
}

// =========================================================== 
// === SECTION printProductList_M550 
// =========================================================== 


/**
 * printProductList_M550
 */

public void printProductList_M550 (){
}


/**
 * printProductList10_M560
 */

public void printProductList10_M560 (){
  performThru("openProductFile_M410", "openProductFileEnd_M430");
  productReportRd.initiate();

  for (int i = 0; i < 10; i++ ){
    perform("printProductList20_M570");
  }
  // goto printProductListEnd_M580; 
  _goto("printProductListEnd_M580");
}


/**
 * printProductList20_M570
 */

public void printProductList20_M570 (){

  // READ statement 
  try {
    productFile.next();
  } catch (AtEndException  e){
    performThru("openProductFile_M410", "openProductFileEnd_M430");
  }
  iData.setWsProdDiscount1(productFile.getFdProdDiscount(0));
  iData.setWsProdDiscount2(productFile.getFdProdDiscount(1));
  iData.setWsProdDiscount3(productFile.getFdProdDiscount(2));
  iData.setWsProdQty1(productFile.getFdProdQty(0));
  iData.setWsProdQty2(productFile.getFdProdQty(1));
  iData.setWsProdQty3(productFile.getFdProdQty(2));
  productReportRd.generate("reportLine");
}


/**
 * printProductListEnd_M580
 */

public void printProductListEnd_M580 (){
  productReportRd.terminate();
}

// =========================================================== 
// === SECTION invalidOption_M590 
// =========================================================== 


/**
 * invalidOption_M590
 */

public void invalidOption_M590 (){
}


/**
 * invalidOption10_M600
 */

public void invalidOption10_M600 (){
  iData.setWsErrMess("Invalid Option, Please Try Again");
  performThru("displayError_M650", "displayErrorEnd_M670");
}


/**
 * invalidOptionEnd_M610
 */

public void invalidOptionEnd_M610 (){
}

// =========================================================== 
// === SECTION displayChoices_M620 
// =========================================================== 


/**
 * displayChoices_M620
 */

public void displayChoices_M620 (){
}


/**
 * displayChoices10_M630
 */

public void displayChoices10_M630 (){
  iData.setWsErrMess("Entry ext , tart Again , xit , 

rint"); performThru("displayError_M650", "displayErrorEnd_M670"); } /** * displayChoicesEnd_M640 */ public void displayChoicesEnd_M640 (){ } // =========================================================== // === SECTION displayError_M650 // =========================================================== /** * displayError_M650 */ public void displayError_M650 (){ } /** * displayError10_M660 */ public void displayError10_M660 (){ } /** * displayErrorEnd_M670 */ public void displayErrorEnd_M670 (){ }