SoftwareMining - Business Rule Extraction and Documentation 

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

public void main_M1050 (){
  company.open(ACMBasePersistence.OPEN_MODE_I_O);

  while ( true ){
    // termination condition 
    if( !ACMUtil.ACMCheck88Vars(iData.getWsAnswer(), iData.wsAnswerWsContinue))
      break;

    if (iData.getWsSuccess().getAsInt() == 1) {
      perform("getNextCustNo_M1060");
      company.getCompanyDetail().fill(" ");
    }
    perform("writeCompDetail_M1070");
  }
  company.close();
  goBack();
}

//  Generate the next Key id (number) 

/**
 * getNextCustNo_M1060
 */

public void getNextCustNo_M1060 (){
  company.setKey1("0");

  // START statement 
  try {
    company.seek(company.getKey1(), ACMBasePersistence.CONDITION_TYPE_EQUALS);
  } catch (InvalidKeyException e){
    company.setCoNextId(0);

    // WRITE statement 
    company.insert();
  }

  // READ statement 
  company.read();
  company.setCoNextId(1 + company.getCoNextId().getAsInt());

  // REWRITE statement 
  company.update();
  company.setCoId(company.getCoNextId());
}

//  save the company detail data 

/**
 * writeCompDetail_M1070
 */

public void writeCompDetail_M1070 (){
  company.setCoRecType(1);
  company.setCoNextId(0);

  // WRITE statement 
  try {
    company.insert();
    iData.setWsSuccess(1);
    iData.setWsErrMess("Company created");
    iData.setWsSelMess(iData.getWsCrtMessValue());
  } catch (InvalidKeyException e){
    iData.setWsSuccess(0);
    iData.setWsErrMess("Duplicate Company Name");
    iData.setWsSelMess(iData.getWsFixMessValue());
  }
}