Community
    • Login

    NppExec Problem

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 905 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • PaoloRicardoP
      PaoloRicardo
      last edited by

      I am trying to compile COBOL programs using GnuCOBOL3. The directory structure for GnuCOBOL is as follows:

      c:\gnucobol3\bin <---- contains cobc, the compiler
      c:\gnucobol3\config <---- contains configuration files for different COBOL dialects
      c:\gnucobol3\copy
      c:\gnucobol3\include
      c:\gnucobol3\lib

      I have a COBOL program DECLARE.CBL in c:\workarea\gnucobol.

      I open NppExec console and enter the following:

      c:\gnucobol3\bin\cobc -x -std=mf $(FULL_CURRENT_PATH) <— mf is Micro Focus dialect

      The response is:
      c:\gnucobol3\bin\cobc -x -std=mf C:\WORKAREA\cobol\GnuCOBOL\declare.cbl
      Process started (PID=1492) >>>
      configuration error:
      mf.conf: No such file or directory
      default.conf: No such file or directory
      <<< Process finished (PID=1492). (Exit code 1)

      NppExec is apparently not examining c:\gnucobol3\config to pick up mf.conf, the configuration file. So how would I set up NppExec to achieve this?

      I can compile the program from the command line using a batch file thus:

      set Path=c:\gnucobol3\bin
      set COB_CONFIG_DIR=c:\gnucobol3\config
      set COB_COPY_DIR=c:\gnucobol3\copy
      set COB_INCLUDE_PATH=c:\gnucobol3\include
      set COB_LIB_PATH=c:\gnucobol3\lib
      cobc -x -std=mf %1 <— where %1 is DECLARE.CBL

      Thanks in advance
      Paul

      PaoloRicardoP 1 Reply Last reply Reply Quote 1
      • PaoloRicardoP
        PaoloRicardo @PaoloRicardo
        last edited by

        @PaoloRicardo

        Sorry, that should be :

        I have a COBOL program DECLARE.CBL in c:\workarea\cobol\gnucobol.

        EkopalypseE 1 Reply Last reply Reply Quote 0
        • EkopalypseE
          Ekopalypse @PaoloRicardo
          last edited by

          @PaoloRicardo

          you would do similar thing in nppexec. As far as I remember it is called set_env or env_set.
          Check the manual, it has a dedicated section describing what you need to do.

          1 Reply Last reply Reply Quote 2
          • PaoloRicardoP
            PaoloRicardo
            last edited by

            Ekopalypse

            Thanks. I entered the following script in the Execute dialog:

            ENV_SET PATH=c:\gnucobol3\bin
            ENV_SET COB_CONFIG_DIR=c:\gnucobol3\config
            ENV_SET COB_COPY_DIR=c:\gnucobol3\copy
            ENV_SET COB_INCLUDE_PATH=c:\gnucobol3\include
            ENV_SET COB_LIB_PATH=c:\gnucobol3\lib
            c:\gnucobol\bin\cobc -x -std=mf $(FULL_CURRENT_PATH)

            When I ran the script I got:

            ENV_SET: PATH=c:\gnucobol3\bin
            $(SYS.PATH) = c:\gnucobol3\bin
            ENV_SET: COB_CONFIG_DIR=c:\gnucobol3\config
            $(SYS.COB_CONFIG_DIR) = c:\gnucobol3\config
            ENV_SET: COB_COPY_DIR=c:\gnucobol3\copy
            $(SYS.COB_COPY_DIR) = c:\gnucobol3\copy
            ENV_SET: COB_INCLUDE_PATH=c:\gnucobol3\include
            $(SYS.COB_INCLUDE_PATH) = c:\gnucobol3\include
            ENV_SET: COB_LIB_PATH=c:\gnucobol3\lib
            $(SYS.COB_LIB_PATH) = c:\gnucobol3\lib
            c:\gnucobol\bin\cobc -x -std=mf C:\WORKAREA\cobol\GnuCOBOL\declare.cbl
            ; about to start a child process: “c:\gnucobol\bin\cobc -x -std=mf C:\WORKAREA\cobol\GnuCOBOL\declare.cbl”
            CreateProcess() failed with error code 2:
            The system cannot find the file specified.

            Is there something that I am missing here?

            Paul

            Meta ChuhM 1 Reply Last reply Reply Quote 0
            • Meta ChuhM
              Meta Chuh moderator @PaoloRicardo
              last edited by Meta Chuh

              @PaoloRicardo

              i have no experience using the nppexec plugin, as i only use the built in “run” functions by calling my own .cmd batch files, which i set as shortcuts at my %AppData%\Notepad++\shortcuts.xml.

              but it looks like your nppexec calls the complete line
              "c:\gnucobol\bin\cobc -x -std=mf C:\WORKAREA\cobol\GnuCOBOL\declare.cbl" as a single argument, calling a long name file with spaces, instead of calling cobc with extra argv parameters like
              "c:\gnucobol\bin\cobc" -x -std=mf "C:\WORKAREA\cobol\GnuCOBOL\declare.cbl"

              what happens if you create a batch file that sets your needed env variables and try it from there ?
              if it works, you can call it by putting the following command into your shortcuts.xml at the UserDefinedCommand section:

              <Command name="YourBatchName" Ctrl="yes" Alt="yes" Shift="yes" Key="88">PathTo\YourBatchName.cmd "$(FULL_CURRENT_PATH)"</Command>

              where “$(FULL_CURRENT_PATH)” will be reflected as %1 inside your batch.

              1 Reply Last reply Reply Quote 1
              • PaoloRicardoP
                PaoloRicardo
                last edited by

                OK, I’ve found the problem. Instead of:

                c:\gnucobol\bin\cobc -x -std=mf $(FULL_CURRENT_PATH)

                I should have c:\gnucobol3\bin\cobc -x -std=mf $(FULL_CURRENT_PATH)
                ^
                Also, since I’ve already defined the PATH variable I can just use:

                cobc -x -std=mf $(FULL_CURRENT_PATH)
                or
                cobc -x -std=mf $(FILE_NAME)

                Thanks for the suggestions, guys.

                Paul

                1 Reply Last reply Reply Quote 3
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors