Highlighted
Absent Member.
Absent Member.
1754 views

Is it possible to NOT REFERENCE called programs from your main program.

Jump to solution

Our existing NET EXPRESS system has a MAIN program in in called REPORTS.CBL.

Within the program there are calls made to upward of 100 potential bespoke report 'sub-programs'.

In Visual COBOL I've found that these 'sub-programs' must be mentioned in the REFERENCES of the main program otherwise the sub program will fail to load when called.

The problem is is that it takes an increasing amount of time to complie the VC COBOL version of the MAIN program as all the sub-program references are added.

Thirty references takes 3 minutes. Sixty takes 6 minutes and 100 references takes almost 10 minutes just to compile the program then another several minutes while it 'thinks' about doing a debug (if requested to do so!!)

Is there a way of calling out to other programs (.dll built) WITHOUT referencing them within the MAIN program as this would be a big help if there is!

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Is it possible to NOT REFERENCE called programs from your main program.

Jump to solution

Actually, there is already a KB article that covers this.

Please see the following:

Call .NET managed code assemblies that are located on a network drive

Be aware that this was a new option in the .NET Framework 4.0 and higher and is not supported if using a previous version of the .NET Framework.

Thanks.

View solution in original post

0 Likes
5 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Is it possible to NOT REFERENCE called programs from your main program.

Jump to solution

It is not neccessary to add a reference to projects that contain programs that the main program will be calling but you do have to make the entry points to these programs available at run-time.

These calls then become "dynamic" calls instead of "static" calls where they are known at compile time.

You can do so by setting the environment variable PATH or COBPATH to include the folder where the .DLLs are located.
If the entry point that you are calling is not the name of the .DLL then you have to preload the .DLL so that the run-time can find the entry point.

This can be done using several methods including:
1.   set procedure-pointer to entry "dllname"
2.   MFENTMAP
3.   Preload section of the app.config file.

I wrote a number of tutorials on this subject and added them to the knowledgebase.
There is a tutorial for each of the different types of code that can be called, i.e, managed-->managed, managed-->native, native-->native, etc.

Please see the following for detailed information:

Tutorial on using CALL statement in managed .NET code.

 

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Is it possible to NOT REFERENCE called programs from your main program.

Jump to solution

In the end I added an APP.CFG file to all my solutions which required call outs to DLLs.

This had to contain the following code...

 <runtime>

   <loadFromRemoteSources enabled="true" />

 </runtime>

The reson for this was that all our .DLL programs reside on the network drives and without this code the calling programs were unable to find the called programs and produced a runtime error when attempting to call them.

Another item for the knowlege database methinks!

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Is it possible to NOT REFERENCE called programs from your main program.

Jump to solution

Actually, there is already a KB article that covers this.

Please see the following:

Call .NET managed code assemblies that are located on a network drive

Be aware that this was a new option in the .NET Framework 4.0 and higher and is not supported if using a previous version of the .NET Framework.

Thanks.

View solution in original post

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

RE: Is it possible to NOT REFERENCE called programs from your main program.

Jump to solution
It appears that this link may be broken.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Is it possible to NOT REFERENCE called programs from your main program.

Jump to solution

That link was to our old knowledgebase.

The same article can now be found here:

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.