public void prepareFileWrite() throws Exception {
    // throw new Exception();
    appHandler = ISISAPI.IsisAppNew();
    ISISAPI.IsisAppDebug(appHandler, Constants.SHOW_NEVER);
    spaceHandler = ISISAPI.IsisSpaNew(appHandler);
    returnCode = ISISAPI.IsisSpaMf(spaceHandler, this.operateFile.getAbsolutePath());
    ISISAPI.IsisSpaMfCreate(spaceHandler);

    this.writeBuffer = new HashMap<String, HashMap<Character, String>>();

    // Reset any reading indicators
    this.controlStruct = null;
    this.currIndex = 1;
  }
  public void prepareFileRead() throws Exception {
    appHandler = ISISAPI.IsisAppNew();
    ISISAPI.IsisAppDebug(appHandler, Constants.SHOW_NEVER);
    spaceHandler = ISISAPI.IsisSpaNew(appHandler);
    returnCode = ISISAPI.IsisSpaMf(spaceHandler, this.operateFile.getAbsolutePath());

    controlStruct = new IsisRecControl();
    returnCode = ISISAPI.IsisRecControlMap(spaceHandler, controlStruct);

    // controlStruct.nxtmfn = 101;

    currIndex = 1;
    this.writeBuffer = null;
  }