NppExec Problem
-
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\libI 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.CBLThanks in advance
Paul -
Sorry, that should be :
I have a COBOL program DECLARE.CBL in c:\workarea\cobol\gnucobol.
-
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. -
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
-
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
%1inside your batch. -
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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login