CALLing sub-program error

I'm trying to develop a project where a main program (say MAINCBL) accepts options and then CALLs sub programs. I created a MAINCBL solution and then added SUBPROG to the solution.

MAINCBL works fine but when I call SUBPROG I get an error message: 'Called program file not found in drive/directory: SUBPROG'.  Both MAINCBL.EXE and SUBPROG.EXE are in my \bin\x86\Debug directory so I'm at a loss to know what's wrong.

I changed the Application properties to Output to: Multiple Executables (not sure if this correct so please correct me if not.)


  • You can't call an EXE.  It needs to be a DLL.  Change it from EXE to a DLL.


  • Austin

    Thanks for the reply. Given that I have SUBPROG.CBL in my project folder alongside MAINCBL.CBL how do I generate SUBPROG.DLL?

    I have found the documentation somewhat confusing since it talks about linking and choosing run time systems.

  • Sorry, I don't have Visual Studio and Visual COBOL available to me at the moment.

    It is a drop-down box on the called program's same tab where you found the Multiple Executables option (which you probably need to set back to the default).

    Also, on the tab where you specify the OUTPUT, that needs to be the same absolute directory - after compiling, use Windows Explorer to make sure the calling EXE and the called DLL are really in the same directory. 

  • I just wanted to add that you'd need to create separate projects, one for the EXE and another for the DLL.

    Since your current project already creates an EXE, you simply need to create a different project identified as 'Link Library' for the subprogram.

    As already indicated by , you may change the Output path for these projects to the same location. This will allow the EXE to find and call the subprogram in DLL.


  • ,

    I removed SUBPROGRAM from the MAINPROG project and created a new SUBPROGRAM Link Library project with its own project folder.

    I compiled the SUBPROGRAM, having set the output directory to be the same one where MAINPROG.EXE resides. A copy of SUBPROGRAM.CBL now sit in the MAINPROG project folder plus SUBPROGRAM.DLL resides alongside MAINPROG.EXE in bin/x86/Debug.

    When I run MAINPROG it attempts to call SUBPROG but I get the same error as before: "173 called program file not found in drive directory".


  • Use Windows Explorer to make sure MAINPROG.EXE and SUBPROGRAM.DLL are both in fact in the same folder.

  • Austin1

    Yes, that's what I did originally. They're both in the Debug folder in the MAINPROG project area. There is nothing in the SUBPROG Debug folder.


  • Sorry you are having so much trouble.

    After you have done it for a while, it becomes second nature, and you don't think much about it as you do it each time.

    My issue is that I am away from work, and cannot bring up Visual Studio, etc.

    Here is something you might want to review closely, including the attachment, as this directly relates to what you are working on.  There are a bunch of these knowledge base items here that can be reviewed for various techniques.


    Please let us know how it goes.  I will need for @Fano to help you if you need further assistance.

  • Sorry, that was   not @Fano.


  • Thanks, Austin1. I can't download/open the file though.