This article explains how to call COBOL subprograms that are located in different directories to the main calling program when executing from a command prompt.
Problem:
When executing a main calling COBOL program from a command prompt, how is it possible to enable any called subprograms that are in different directories to be found and called successfully?
For example: program1.int resides in c:\\dir1 and program2.int resides in c:\\dir2 and program3.int resides in c:\\dir3 and so on…
As it stands, if you were to execute program1.int from a command prompt, when it called program2.int you would get a 173 file not found error displayed as the subprogram is not in the main folder.
Resolution:
You need to set the COBDIR environment variable if called module is not found in the current directory. This can be done as follows in relation to the scenario described above by creating a .bat file containing the following entries:
setlocal
set COBDIR=c:\\dir1;c:\\dir2;c:\\dir3;%COBDIR%
run c:\\dir1\\program1.int
endlocal
Incident Number: 2285147