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.)
Thanks
You can't call an EXE.  It needs to be a DLL.  Change it from EXE to a DLL.
 
                
     
                                    
            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.
                
     
                                    
            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. 
                
     
                                    
            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 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".
???
                
     
                                    
            , 
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.
                
     
                                    
            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.
 
                
     
                                    
            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 Tutorial.zip 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.
/cobol/visualcobol/w/wikiid-120/34260/visual-cobol-for-visual-studio---solutions-projects-and-the-cobol-call-statement---native
Please let us know how it goes.  I will need for @Fano to help you if you need further assistance.
                
     
                                    
            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 Tutorial.zip 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.
/cobol/visualcobol/w/wikiid-120/34260/visual-cobol-for-visual-studio---solutions-projects-and-the-cobol-call-statement---native
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.
 
                
     
                                    
            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 Tutorial.zip 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.
/cobol/visualcobol/w/wikiid-120/34260/visual-cobol-for-visual-studio---solutions-projects-and-the-cobol-call-statement---native
Please let us know how it goes.  I will need for @Fano to help you if you need further assistance.
Thanks, Austin1. I can't download/open the tutorial.zip file though.
                
     
                                    
            Thanks, Austin1. I can't download/open the tutorial.zip file though.
Try the attached simple demo where MainProg calls SubProg. Both projects have the output path pointing to ..\\Deploy, which gets created if it doesn't exist.
                
     
                                    
            Try the attached simple demo where MainProg calls SubProg. Both projects have the output path pointing to ..\\Deploy, which gets created if it doesn't exist.
Just to confirm and verify, that worked for me - I was able to download it and bring it up under Visual Studio and do a BUILD, Rebuild Solution on it and then a DEBUG, Start Without Debugging.
 
                
     
                                    
            Try the attached simple demo where MainProg calls SubProg. Both projects have the output path pointing to ..\\Deploy, which gets created if it doesn't exist.
Fano_MF
That worked, as expected. I checked the Properties in my MAINPROG and the only difference with your solution was that I had in COBOL LINK -> Run Time Model -> Shared whereas yours was Dynamic.
The other difference is that I have 2 separate projects (as I believe I was advised by Austin1), MAINPROG and SUBPROG whereas yours seemed to be MAINPROG solution containing 2 projects.
I am stumped. This is a modernisation/rewrite of  a program that I wrote in 2005. In those days, when I was using Professional COBOL, I seem to recall that it was possible to call .EXE files or .INT/.GNT files rather than .DLL files.
                
     
                                    
            Fano_MF
That worked, as expected. I checked the Properties in my MAINPROG and the only difference with your solution was that I had in COBOL LINK -> Run Time Model -> Shared whereas yours was Dynamic.
The other difference is that I have 2 separate projects (as I believe I was advised by Austin1), MAINPROG and SUBPROG whereas yours seemed to be MAINPROG solution containing 2 projects.
I am stumped. This is a modernisation/rewrite of  a program that I wrote in 2005. In those days, when I was using Professional COBOL, I seem to recall that it was possible to call .EXE files or .INT/.GNT files rather than .DLL files.
Well, I'm going to have to start again. I screwed up my MAINPROG.cbl file and I don't have a backup . So back to the drawing board. Thanks for the help Fano_MF and Austin1.
                
     
                                    
            Well, I'm going to have to start again. I screwed up my MAINPROG.cbl file and I don't have a backup . So back to the drawing board. Thanks for the help Fano_MF and Austin1.
You might take a look at the following article which I wrote quite a while ago that covers this topic in detail.
Visual-COBOL for Visual Studio Solutions Projects and the COBOL CALL Statement
                
     
                                    
            You might take a look at the following article which I wrote quite a while ago that covers this topic in detail.
Visual-COBOL for Visual Studio Solutions Projects and the COBOL CALL Statement
Thanks, Chris. Have downloaded the file.
Just for the record, and using the Visual COBOL videos as a guide, I now have a successful MAIN program CALLing 5 sub-programs.