private CEntityResourceFormContainer doAllAnalysisforResFiles(
      String filename, String csApplication, CTransApplicationGroup grp, boolean bResources) {
    String csFileNameNoExt = FileSystem.getNameWithoutExtension(filename);
    if (csFileNameNoExt.endsWith("S")) {
      String map = csFileNameNoExt.substring(0, csFileNameNoExt.length() - 1);
      CEntityResourceFormContainer cont = m_cat.GetFormContainer(map, grp, bResources);
      if (cont != null) {
        String fileNameJavaS = grp.m_csOutputPath + csFileNameNoExt + ".java";
        CJavaExporter outjavaS = new CJavaExporter(cont.getExporter(), fileNameJavaS);
        CJavaEntityFactory factoryS = new CJavaEntityFactory(cont.m_ProgramCatalog, outjavaS);
        CEntityResourceFormContainer eSav = cont.MakeSavCopy(factoryS, false);
        m_cat.RegisterFormContainer(eSav.GetName(), eSav);
        if (m_FormEnhancer != null) m_FormEnhancer.ProcessFormContainer(eSav, bResources);
        return eSav;
      }
    }

    CEntityResourceFormContainer ext = importRESResource(filename, csApplication, grp, bResources);
    if (ext != null) m_cat.RegisterFormContainer(filename, ext);
    return ext;
  }
  private CEntityResourceFormContainer importRESResource(
      String inputFileName, String csApplication, CTransApplicationGroup grp, boolean bResources) {
    String csOutputFile = generateOutputFileName(inputFileName);
    CTransApplicationGroup grpResources = m_cat.getGroupResources();
    String csFullInputFileName = grpResources.m_csOutputPath + inputFileName;

    // String csOutputFile = generateOutputFileName(inputFileName) ;
    // createDirIsRequired(grp.m_csOutputPath, csApplication);	// For .res output

    Tag tagRoot = Tag.createFromFile(csFullInputFileName);
    if (tagRoot == null) return null;

    if (grp.m_csOutputPath != null)
      createDirIsRequired(grp.m_csOutputPath, csApplication); // For .java output

    CBMSParser BMSParser = parseRESResource(tagRoot);
    if (BMSParser != null) {
      Transcoder.logInfo("Transcoding resource " + inputFileName);
      // exportXMLToFile(BMSParser, "D:/Dev/naca/Pub2000Cobol/Inter/BMS/RS01A05b.xml") ; // Reexport
      // XML

      NotificationEngine engine = new NotificationEngine();
      doPopulateSpecialActionHandlers(engine);
      COriginalLisiting listing = new COriginalLisiting();
      CObjectCatalog cat = new CObjectCatalog(m_cat, listing, grp.m_eType, engine);
      try {
        if (grp.m_csOutputPath != null) {
          String csJavaOutFileName =
              FileSystem.appendFilePath(
                  grp.m_csOutputPath + csApplication,
                  ReplaceExtensionFileName(csOutputFile, "java"));
          CEntityResourceFormContainer ext =
              doSemanticAnalysis(BMSParser, csJavaOutFileName, cat, grp, bResources);
          if (ext != null) {
            // To reexport .res file, uncomment below
            //						String csResOutFileName = grp.m_csOutputPath +
            // ReplaceExtensionFileName(csOutputFile, "res");
            //						ext.setExportFilePath(csResOutFileName);
            //
            //						Transcoder.logInfo("Exporting resource file "+csResOutFileName);
            //						ext.MakeXMLOutput(true) ;

            m_cat.RegisterFormContainer(inputFileName, ext);

            // PJD 08/08/2007 Uncomment to export xxx.java screen copy file. These are duplicated
            // files generated twice beforecorrect generation export by
            // Transcoder.logInfo("Exporting java file "+csJavaOutFileName);
            // ext.StartExport() ;

            String fileNameJavaS =
                FileSystem.appendFilePath(
                    grp.m_csOutputPath + csApplication,
                    ReplaceExtensionFileNameWithSuffix(csOutputFile, "S", "java"));
            // String fileNameJavaS = grp.m_csOutputPath + csApplication + "/" +
            // ReplaceExtensionFileNameWithSuffix(csOutputFile, "S", "java");
            CJavaExporter outjavaS = new CJavaExporter(ext.getExporter(), fileNameJavaS);
            CJavaEntityFactory factoryS0 = new CJavaEntityFactory(ext.m_ProgramCatalog, outjavaS);
            m_cat = ms_BMSTranscoderEngine.getGlobalCatalog();
            CJavaEntityFactory factoryS = new CJavaEntityFactory(cat, outjavaS);

            ext.clearSavCopy(factoryS);

            CEntityResourceFormContainer eSav =
                ext.MakeSavCopy(
                    factoryS,
                    true); // we are generating directly form a .res file; the name of variables in
                           // *S.java file is not very well managed in taht case, so, the flag ...
            if (ext.GetSavCopy() != null) {
              // PJD 08/08/2007 Uncomment to export xxxS.java screen copy file. These are duplicated
              // files generated twice beforecorrect generation export by
              //							Transcoder.logInfo("Exporting javaS file "+fileNameJavaS);
              //							ext.GetSavCopy().StartExport() ;
            }
          }
          return ext;
        }
      } catch (NacaTransAssertException e) {
        Transcoder.logError(
            "Failure while transcoding " + csFullInputFileName + " : " + e.m_csMessage);
      }
    }

    return null;
  }