Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
robswindells Absent Member.
Absent Member.
423 views

Calling Cobol 5.1 GNT from Visual Cobol dynamically at runtime

We have a Cobol 5.1 Menu system that calls one of 1,000’s of application gnt programs depending on option chosen.

We want to create a graphical menu system in Visual Cobol that can call the existing Gnt applications.

 

I have created a simple test program that accepts a folder name and a program name then calls the requested program. The test program works fine until I call the test gnt program.

The test program was compiled using visual Cobol command line compile to produce the GNT application.

 

The call results in the error:

FAILMicroFocus.COBOL.COBOLRuntimeException: 174     Imported file not found

(Could not load file or assembly 'file:///C:\Silverlink\v3.9\wintne\lib\restest.gnt' or one of its dependencies. The module was expected to contain an assembly manifest.) ---> System.BadImageFormatException: Could not load file or assembly 'file:///C:\Silverlink\v3.9\wintne\lib\restest.gnt' or one of its dependencies. The module was expected to contain an assembly manifest.

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)

   at System.Reflection.Assembly.LoadFrom(String assemblyFile)

   at MicroFocus.COBOL.Runtime.Win32.PlatformAbstraction.LoadFrom(String assemblyFile)

   at MicroFocus.COBOL.Runtime.BaseFinder.LoadAssembly(RunUnit runUnit, String assemblyName, Boolean hasEvidence)

   --- End of inner exception stack trace ---

   at MicroFocus.COBOL.Runtime.BaseFinder.LoadAssembly(RunUnit runUnit, String assemblyName, Boolean hasEvidence)

   at MicroFocus.COBOL.Runtime.LoadAndSearchAssembly.FindProgram(RunUnit runUnit, ProgramName progName)

   at MicroFocus.COBOL.Runtime.BaseFinder.Action(Object obj)

   at MicroFocus.COBOL.Runtime.Common.PrioritizedList.Action(Object actionData, Boolean remove)

   at MicroFocus.COBOL.Runtime.ProgramFinder.FindProgram(RunUnit runUnit, ProgramName progName)

   at MicroFocus.COBOL.Runtime.Common.RunUnit.GetLoadedOrNewProgram(String program, Object& instance)

   at MicroFocus.COBOL.Program.ProcedurePointer.CreateProcedurePointer(RunUnit runUnit, String programName)

   at MicroFocus.COBOL.Program.ProcedurePointer.GetProcedurePointer(RunUnit runUnit, String name)

   at MicroFocus.COBOL.Program.Control.CallReturningObject(UInt32 callConvention, String program, Object[] parameters, IObjectControl pgInstance)

   at MicroFocus.COBOL.Program.Control.Call(UInt32 callConvention, String program, Object[] parameters, IObjectControl pgInstance)

   at libtest.Form1.Callprog_Click(Object sender, EventArgs e) in L:\v3.9\wcbl\lib\libtest\Form1.cbl:line 92

 

Source code available if required.

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

RE: Calling Cobol 5.1 GNT from Visual Cobol dynamically at runtime

Sorry calling .gnt directly is not possible.

If you can compile the program as .dll then you stand a better change but it will depened on if the parameters can be passed the native core.
0 Likes
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.