SoftwareMining - Business Rule Extraction and Documentation 

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

public void c0000ProcessCustomerMaint_M1300 (){
  if (eib.getEibcalen().getAsInt() > 0) {
    iData.setCommunicationArea(lnk.getXxDfhcommareaValue());
  }
  if (eib.getEibcalen().getAsInt() == 0) {
    mntset2.getMntmap1o().setLowValues();
    mntset2.setCustno1l(-1);
    iData.setSendFlag(iData.sendFlagSendErase[0].minString());
    perform("c1500SendKeyMap_M1360");
    iData.setCaContextFlag(iData.caContextFlagProcessKeyMap[0].minString());
  } else if (ACMUtil.compare(eib.getEibaid(), dfhaid.getDfhpf3()) == 0) {
      // ** Newly modified CICS support. Please doublecheck. PC_CICS_XCTL_CLASS. ** 
      cicsXctl( new XctlDO()
        .setProgram("INVMENU"));
    } else if (ACMUtil.compare(eib.getEibaid(), dfhaid.getDfhpf12()) == 0) {
        if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessKeyMap)) {
          // ** Newly modified CICS support. Please doublecheck. PC_CICS_XCTL_CLASS. ** 
          cicsXctl( new XctlDO()
            .setProgram("INVMENU"));
        } else {
          mntset2.getMntmap1o().setLowValues();
          mntset2.setCustno1l(-1);
          iData.setSendFlag(iData.sendFlagSendErase[0].minString());
          perform("c1500SendKeyMap_M1360");
          iData.setCaContextFlag(iData.caContextFlagProcessKeyMap[0].minString());
        }
      } else if (ACMUtil.compare(eib.getEibaid(), dfhaid.getDfhclear()) == 0) {
          if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessKeyMap)) {
            mntset2.getMntmap1o().setLowValues();
            mntset2.setCustno1l(-1);
            iData.setSendFlag(iData.sendFlagSendErase[0].minString());
            perform("c1500SendKeyMap_M1360");
          } else {
            mntset2.getMntmap2o().setLowValues();
            mntset2.setCustno2o(iData.getCaCustomerNumberValue());
            if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessAddCustomer)) {
              mntset2.setInstr2o(iData.getAddInstructionValue());
            } else if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessChangeCustomer)) {
                mntset2.setInstr2o(iData.getChangeInstructionValue());
              } else if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessDeleteCustomer)) {
                  mntset2.setInstr2o(iData.getDeleteInstructionValue());
                }
            mntset2.setLnamel(-1);
            iData.setSendFlag(iData.sendFlagSendErase[0].minString());
            perform("c1400SendDataMap_M1350");
          }
        } else if ((ACMUtil.compare(eib.getEibaid(), dfhaid.getDfhpa1()) == 0) || 
             ((ACMUtil.compare(eib.getEibaid(), dfhaid.getDfhpa2()) == 0) || 
               (ACMUtil.compare(eib.getEibaid(), dfhaid.getDfhpa3()) == 0))) {
            ; // continue
          } else if (ACMUtil.compare(eib.getEibaid(), dfhaid.getDfhenter()) == 0) {
              if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessKeyMap)) {
                perform("c1000ProcessKeyMap_M1310");
              } else if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessAddCustomer)) {
                  perform("c2000ProcessAddCustomer_M1370");
                } else if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessChangeCustomer)) {
                    perform("c3000ProcessChangeCustomer_M1410");
                  } else if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessDeleteCustomer)) {
                      perform("c4000ProcessDeleteCustomer_M1440");
                    }
            } else {
              if (ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessKeyMap)) {
                mntset2.getMntmap1o().setLowValues();
                mntset2.setMsg1o("That key is unassigned.");
                mntset2.setCustno1l(-1);
                iData.setSendFlag(iData.sendFlagSendDataonlyAlarm[0].minString());
                perform("c1500SendKeyMap_M1360");
              } else {
                mntset2.getMntmap2o().setLowValues();
                mntset2.setMsg2o("That key is unassigned.");
                mntset2.setLnamel(-1);
                iData.setSendFlag(iData.sendFlagSendDataonlyAlarm[0].minString());
                perform("c1400SendDataMap_M1350");
              }
            }
  // ** Newly modified CICS support. Please doublecheck. PC_CICS_RETURN_CLASS. ** 
  cicsReturn( new ReturnDO()
    .setTransid("MNT2")
    .setCommarea(iData.getCommunicationArea()));
}


/**
 * c1000ProcessKeyMap_M1310
 */

public void c1000ProcessKeyMap_M1310 (){
  perform("c1100ReceiveKeyMap_M1320");
  perform("c1200EditKeyData_M1330");
  if (ACMUtil.ACMCheck88Vars(iData.getValidDataSw(), iData.validDataSwValidData)) {
    if ( !ACMUtil.ACMCheck88Vars(iData.getCaContextFlag(), iData.caContextFlagProcessDeleteCustomer)) {
      inspect = new ACMInspectProcessor(custmas.getCustomerMasterRecord());
      inspect.addStatement(ACMInspect.REPLACING, ACMInspect.ALL, " ", "_", null, null);
      inspect.process();
    }
    mntset2.setCustno2o(mntset2.getCustno1iValue());
    mntset2.setLnameo(custmas.getCmLastNameValue());
    mntset2.setFnameo(custmas.getCmFirstNameValue());
    mntset2.setAddro(custmas.getCmAddressValue());
    mntset2.setCityo(custmas.getCmCityValue());
    mntset2.setStateo(custmas.getCmStateValue());
    mntset2.setZipcodeo(custmas.getCmZipCodeValue());
    mntset2.setLnamel(-1);
    iData.setSendFlag(iData.sendFlagSendErase[0].minString());
    perform("c1400SendDataMap_M1350");
  } else {
    mntset2.getActiono().setLowValues();
    mntset2.getCustno1o().setLowValues();
    iData.setSendFlag(iData.sendFlagSendDataonlyAlarm[0].minString());
    perform("c1500SendKeyMap_M1360");
  }
}


/**
 * c1100ReceiveKeyMap_M1320
 */

public void c1100ReceiveKeyMap_M1320 (){
  inspect = new ACMInspectProcessor(mntset2.getMntmap1i());
  inspect.addStatement(ACMInspect.REPLACING, ACMInspect.ALL, "_", " ", null, null);
  inspect.process();
}


/**
 * c1200EditKeyData_M1330
 */

public void c1200EditKeyData_M1330 (){
  mntset2.setCustno1h(attr.getAttrNoHighlightValue());
  mntset2.setActionh(attr.getAttrNoHighlightValue());
  if ((ACMUtil.compare(mntset2.getActioni(), "1") != 0) && 
     ((ACMUtil.compare(mntset2.getActioni(), "2") != 0) && 
       (ACMUtil.compare(mntset2.getActioni(), "3") != 0))) {
    mntset2.setActionh(attr.getAttrReverseValue());
    mntset2.setActionl(-1);
    mntset2.setMsg1o("Action must be 1, 2, or 3.");
    iData.setValidDataSw("N");
  } else {
    mntset2.getMsg1o().fill(" ");
    iData.setValidDataSw("Y");
  }
  if ((mntset2.getCustno1l().getAsInt() == 0) || 
     (mntset2.getCustno1i().isFilled(' '))) {
    mntset2.setCustno1h(attr.getAttrReverseValue());
    mntset2.setCustno1l(-1);
    mntset2.setMsg1o("You must enter a customer number.");
    iData.setValidDataSw("N");
  }
  if (ACMUtil.ACMCheck88Vars(iData.getValidDataSw(), iData.validDataSwValidData)) {
    mntset2.getMntmap2o().setLowValues();
    if (ACMUtil.compare(mntset2.getActioni(), "1") == 0) {
      perform("c1300ReadCustomerRecord_M1340");
      if (iData.getResponseCode().getAsInt() == RESP_CODE_NOTFND) {
        mntset2.setInstr2o(iData.getAddInstructionValue());
        iData.setCaContextFlag(iData.caContextFlagProcessAddCustomer[0].minString());
        custmas.getCustomerMasterRecord().fill(" ");
      } else if (iData.getResponseCode().getAsInt() == RESP_CODE_NORMAL) {
          mntset2.setMsg1o("That customer already exists.");
          iData.setValidDataSw("N");
        }
    } else if (ACMUtil.compare(mntset2.getActioni(), "2") == 0) {
        perform("c1300ReadCustomerRecord_M1340");
        if (iData.getResponseCode().getAsInt() == RESP_CODE_NORMAL) {
          iData.setCaCustomerRecord(custmas.getCustomerMasterRecordValue());
          mntset2.setInstr2o(iData.getChangeInstructionValue());
          iData.setCaContextFlag(iData.caContextFlagProcessChangeCustomer[0].minString());
        } else if (iData.getResponseCode().getAsInt() == RESP_CODE_NOTFND) {
            mntset2.setMsg1o("That customer does not exist.");
            iData.setValidDataSw("N");
          }
      } else if (ACMUtil.compare(mntset2.getActioni(), "3") == 0) {
          perform("c1300ReadCustomerRecord_M1340");
          if (iData.getResponseCode().getAsInt() == RESP_CODE_NORMAL) {
            iData.setCaCustomerRecord(custmas.getCustomerMasterRecordValue());
            mntset2.setInstr2o(iData.getDeleteInstructionValue());
            iData.setCaContextFlag(iData.caContextFlagProcessDeleteCustomer[0].minString());
            mntset2.setZipcodea(attr.getAttrProtValue());
            mntset2.setStatea(attr.getAttrProtValue());
            mntset2.setCitya(attr.getAttrProtValue());
            mntset2.setAddra(attr.getAttrProtValue());
            mntset2.setFnamea(attr.getAttrProtValue());
            mntset2.setLnamea(attr.getAttrProtValue());
          } else if (iData.getResponseCode().getAsInt() == RESP_CODE_NOTFND) {
              mntset2.setMsg1o("That customer does not exist.");
              iData.setValidDataSw("N");
            }
        }
  }
}


/**
 * c1300ReadCustomerRecord_M1340
 */

public void c1300ReadCustomerRecord_M1340 (){
  cicsRead( new ReadDO()
    .setFile("CUSTMAS")
    .setInto(custmas.getCustomerMasterRecord())
    .setRidfld(mntset2.getCustno1i())
    .setResp(iData.getResponseCode()));
  if ((iData.getResponseCode().getAsInt() != RESP_CODE_NORMAL) && 
     (iData.getResponseCode().getAsInt() != RESP_CODE_NOTFND)) {
    perform("c9999TerminateProgram_M1460");
  }
}


/**
 * c1400SendDataMap_M1350
 */

public void c1400SendDataMap_M1350 (){
  mntset2.setTranid2o("MNT2");
  if (ACMUtil.ACMCheck88Vars(iData.getSendFlag(), iData.sendFlagSendErase)) {
  } else if (ACMUtil.ACMCheck88Vars(iData.getSendFlag(), iData.sendFlagSendDataonlyAlarm)) {
    }
}


/**
 * c1500SendKeyMap_M1360
 */

public void c1500SendKeyMap_M1360 (){
  mntset2.setTranid1o("MNT2");
  if (ACMUtil.ACMCheck88Vars(iData.getSendFlag(), iData.sendFlagSendErase)) {
  } else if (ACMUtil.ACMCheck88Vars(iData.getSendFlag(), iData.sendFlagSendEraseAlarm)) {
    } else if (ACMUtil.ACMCheck88Vars(iData.getSendFlag(), iData.sendFlagSendDataonlyAlarm)) {
      }
}


/**
 * c2000ProcessAddCustomer_M1370
 */

public void c2000ProcessAddCustomer_M1370 (){
  perform("c2100ReceiveDataMap_M1380");
  perform("c2200EditCustomerData_M1390");
  if (ACMUtil.ACMCheck88Vars(iData.getValidDataSw(), iData.validDataSwValidData)) {
    perform("c2300WriteCustomerRecord_M1400");
    if (iData.getResponseCode().getAsInt() == RESP_CODE_NORMAL) {
      mntset2.setMsg1o("Customer record added.");
      iData.setSendFlag(iData.sendFlagSendErase[0].minString());
    } else if (iData.getResponseCode().getAsInt() == RESP_CODE_DUPREC) {
        mntset2.setMsg1o("Another user has added a record with that customer number.");
        iData.setSendFlag(iData.sendFlagSendEraseAlarm[0].minString());
      }
    mntset2.setCustno1l(-1);
    perform("c1500SendKeyMap_M1360");
    iData.setCaContextFlag(iData.caContextFlagProcessKeyMap[0].minString());
  } else {
    mntset2.getZipcodeo().setLowValues();
    mntset2.getStateo().setLowValues();
    mntset2.getCityo().setLowValues();
    mntset2.getAddro().setLowValues();
    mntset2.getFnameo().setLowValues();
    mntset2.getLnameo().setLowValues();
    iData.setSendFlag(iData.sendFlagSendDataonlyAlarm[0].minString());
    perform("c1400SendDataMap_M1350");
  }
}


/**
 * c2100ReceiveDataMap_M1380
 */

public void c2100ReceiveDataMap_M1380 (){
  inspect = new ACMInspectProcessor(mntset2.getMntmap2i());
  inspect.addStatement(ACMInspect.REPLACING, ACMInspect.ALL, "_", " ", null, null);
  inspect.process();
}


/**
 * c2200EditCustomerData_M1390
 */

public void c2200EditCustomerData_M1390 (){
  mntset2.setLnameh(attr.getAttrNoHighlightValue());
  mntset2.setFnameh(attr.getAttrNoHighlightValue());
  mntset2.setAddrh(attr.getAttrNoHighlightValue());
  mntset2.setCityh(attr.getAttrNoHighlightValue());
  mntset2.setStateh(attr.getAttrNoHighlightValue());
  mntset2.setZipcodeh(attr.getAttrNoHighlightValue());
  if ((mntset2.getZipcodei().isFilled(' ')) || 
     (mntset2.getZipcodel().getAsInt() == 0)) {
    mntset2.setZipcodeh(attr.getAttrReverseValue());
    mntset2.setZipcodel(-1);
    mntset2.setMsg2o("You must enter a zip code.");
    iData.setValidDataSw("N");
  }
  if ((mntset2.getStatei().isFilled(' ')) || 
     (mntset2.getStatel().getAsInt() == 0)) {
    mntset2.setStateh(attr.getAttrReverseValue());
    mntset2.setStatel(-1);
    mntset2.setMsg2o("You must enter a state.");
    iData.setValidDataSw("N");
  }
  if ((mntset2.getCityi().isFilled(' ')) || 
     (mntset2.getCityl().getAsInt() == 0)) {
    mntset2.setCityh(attr.getAttrReverseValue());
    mntset2.setCityl(-1);
    mntset2.setMsg2o("You must enter a city.");
    iData.setValidDataSw("N");
  }
  if ((mntset2.getAddri().isFilled(' ')) || 
     (mntset2.getAddrl().getAsInt() == 0)) {
    mntset2.setAddrh(attr.getAttrReverseValue());
    mntset2.setAddrl(-1);
    mntset2.setMsg2o("You must enter an address.");
    iData.setValidDataSw("N");
  }
  if ((mntset2.getFnamei().isFilled(' ')) || 
     (mntset2.getFnamel().getAsInt() == 0)) {
    mntset2.setFnameh(attr.getAttrReverseValue());
    mntset2.setFnamel(-1);
    mntset2.setMsg2o("You must enter a first name.");
    iData.setValidDataSw("N");
  }
  if ((mntset2.getLnamei().isFilled(' ')) || 
     (mntset2.getLnamel().getAsInt() == 0)) {
    mntset2.setLnameh(attr.getAttrReverseValue());
    mntset2.setLnamel(-1);
    mntset2.setMsg2o("You must enter a last name.");
    iData.setValidDataSw("N");
  }
}


/**
 * c2300WriteCustomerRecord_M1400
 */

public void c2300WriteCustomerRecord_M1400 (){
  custmas.setCmCustomerNumber(mntset2.getCustno2iValue());
  custmas.setCmLastName(mntset2.getLnameiValue());
  custmas.setCmFirstName(mntset2.getFnameiValue());
  custmas.setCmAddress(mntset2.getAddriValue());
  custmas.setCmCity(mntset2.getCityiValue());
  custmas.setCmState(mntset2.getStateiValue());
  custmas.setCmZipCode(mntset2.getZipcodeiValue());
  // ** Newly modified CICS support. Please doublecheck. PC_CICS_WRITE_CLASS. ** 
  cicsWrite( new WriteDO()
    .setFile("CUSTMAS")
    .setFrom(custmas.getCustomerMasterRecord())
    .setRidfld(custmas.getCmCustomerNumber())
    .setResp(iData.getResponseCode()));
  if ((iData.getResponseCode().getAsInt() != RESP_CODE_NORMAL) && 
     (iData.getResponseCode().getAsInt() != RESP_CODE_DUPREC)) {
    perform("c9999TerminateProgram_M1460");
  }
}


/**
 * c3000ProcessChangeCustomer_M1410
 */

public void c3000ProcessChangeCustomer_M1410 (){
  perform("c2100ReceiveDataMap_M1380");
  perform("c2200EditCustomerData_M1390");
  if (ACMUtil.ACMCheck88Vars(iData.getValidDataSw(), iData.validDataSwValidData)) {
    custmas.setCmCustomerNumber(mntset2.getCustno2iValue());
    perform("c3100ReadCustomerForUpdate_M1420");
    if (iData.getResponseCode().getAsInt() == RESP_CODE_NORMAL) {
      if (ACMUtil.compare(custmas.getCustomerMasterRecord(), iData.getCaCustomerRecord()) == 0) {
        perform("c3200RewriteCustomerRecord_M1430");
        mntset2.setMsg1o("Customer record updated.");
        iData.setSendFlag(iData.sendFlagSendErase[0].minString());
      } else {
        mntset2.setMsg1o("Another user has updated the record.  Try again.");
        iData.setSendFlag(iData.sendFlagSendEraseAlarm[0].minString());
      }
    } else if (iData.getResponseCode().getAsInt() == RESP_CODE_NOTFND) {
        mntset2.setMsg1o("Another user has deleted the record.");
        iData.setSendFlag(iData.sendFlagSendEraseAlarm[0].minString());
      }
    mntset2.setCustno1l(-1);
    perform("c1500SendKeyMap_M1360");
    iData.setCaContextFlag(iData.caContextFlagProcessKeyMap[0].minString());
  } else {
    mntset2.getZipcodeo().setLowValues();
    mntset2.getStateo().setLowValues();
    mntset2.getCityo().setLowValues();
    mntset2.getAddro().setLowValues();
    mntset2.getFnameo().setLowValues();
    mntset2.getLnameo().setLowValues();
    iData.setSendFlag(iData.sendFlagSendDataonlyAlarm[0].minString());
    perform("c1400SendDataMap_M1350");
  }
}


/**
 * c3100ReadCustomerForUpdate_M1420
 */

public void c3100ReadCustomerForUpdate_M1420 (){
  cicsRead( new ReadDO()
    .setFile("CUSTMAS")
    .setInto(custmas.getCustomerMasterRecord())
    .setRidfld(custmas.getCmCustomerNumber())
    .setUpdate()
    .setResp(iData.getResponseCode()));
  if ((iData.getResponseCode().getAsInt() != RESP_CODE_NORMAL) && 
     (iData.getResponseCode().getAsInt() != RESP_CODE_NOTFND)) {
    perform("c9999TerminateProgram_M1460");
  }
}


/**
 * c3200RewriteCustomerRecord_M1430
 */

public void c3200RewriteCustomerRecord_M1430 (){
  custmas.setCmLastName(mntset2.getLnameiValue());
  custmas.setCmFirstName(mntset2.getFnameiValue());
  custmas.setCmAddress(mntset2.getAddriValue());
  custmas.setCmCity(mntset2.getCityiValue());
  custmas.setCmState(mntset2.getStateiValue());
  custmas.setCmZipCode(mntset2.getZipcodeiValue());
  // ** Newly modified CICS support. Please doublecheck. PC_CICS_REWRITE_CLASS. ** 
  cicsRewrite( new RewriteDO()
    .setFile("CUSTMAS")
    .setFrom(custmas.getCustomerMasterRecord())
    .setResp(iData.getResponseCode()));
  if (iData.getResponseCode().getAsInt() != RESP_CODE_NORMAL) {
    perform("c9999TerminateProgram_M1460");
  }
}


/**
 * c4000ProcessDeleteCustomer_M1440
 */

public void c4000ProcessDeleteCustomer_M1440 (){
  custmas.setCmCustomerNumber(iData.getCaCustomerNumberValue());
  perform("c3100ReadCustomerForUpdate_M1420");
  if (iData.getResponseCode().getAsInt() == RESP_CODE_NORMAL) {
    if (ACMUtil.compare(custmas.getCustomerMasterRecord(), iData.getCaCustomerRecord()) == 0) {
      perform("c4100DeleteCustomerRecord_M1450");
      mntset2.setMsg1o("Customer deleted.");
      iData.setSendFlag(iData.sendFlagSendErase[0].minString());
    } else {
      mntset2.setMsg1o("Another user has updated the record.  Try again.");
      iData.setSendFlag(iData.sendFlagSendEraseAlarm[0].minString());
    }
  } else if (iData.getResponseCode().getAsInt() == RESP_CODE_NOTFND) {
      mntset2.setMsg1o("Another user has deleted the record.");
      iData.setSendFlag(iData.sendFlagSendEraseAlarm[0].minString());
    }
  mntset2.setCustno1l(-1);
  perform("c1500SendKeyMap_M1360");
  iData.setCaContextFlag(iData.caContextFlagProcessKeyMap[0].minString());
}


/**
 * c4100DeleteCustomerRecord_M1450
 */

public void c4100DeleteCustomerRecord_M1450 (){
  // ** Newly modified CICS support. Please doublecheck. PC_CICS_DELETE_CLASS. ** 
  cicsDelete( new DeleteDO()
    .setFile("CUSTMAS")
    .setResp(iData.getResponseCode()));
  if (iData.getResponseCode().getAsInt() != RESP_CODE_NORMAL) {
    perform("c9999TerminateProgram_M1460");
  }
}


/**
 * c9999TerminateProgram_M1460
 */

public void c9999TerminateProgram_M1460 (){
  errparm.setErrResp(eib.getEibresp().getAsInt());
  errparm.setErrResp2(eib.getEibresp2().getAsInt());
  errparm.setErrTrnid(eib.getEibtrnidValue());
  errparm.setErrRsrce(eib.getEibrsrceValue());
  // ** Newly modified CICS support. Please doublecheck. PC_CICS_XCTL_CLASS. ** 
  cicsXctl( new XctlDO()
    .setProgram("SYSERR")
    .setCommarea(errparm.getErrorParameters()));
}