Our vBulletin migration is complete.
Welcome vBulletin users! All content and user information from the Micro Focus Forums (vBulletin) site has been migrated to this site. READ MORE.
brendang
New Member.
2048 views

VC 2.1 to 2.3

Jump to solution

Hi

We are upgrading an application from Visual Cobol 2.1 on Windows XP to Visual Cobol 2.3 on Windows 10.  The application consists of windows forms projects and native code programs compiled as managed code.  We have been using VS 2010 Shell on Windows XP.  A couple of queries:

I installed VS 2015 Community on a new Windows 10 pc and registered for the 30 day trial of VC 2.3.  In the link sent back, Step 1 - Useful Download Details, states that there are two versions of Visual Cobol available to download, VC for VS 2012 and VC for VS 2013, yet under the Software/Licenses section at the bottom VC for VS 2015 is also available for download, so this is the one I chose.  Are the instructions on the link out of date?  I assume it was safe to download VC for VS 2015 if VS 2015 Community is installed?

The target framework for the VC 2.1 version of the app is either .NET framework 4 Client Profile for the windows forms projects, or .NET framework 4 for the non windows forms projects.  In VC 2.3 on Windows 10 should we be chaning the target framework toa more recent version, or is it safe to leave as is?  Is it better to use the latest version of the .NET framework.  I cretaed a new windows forms app on the Windows 10 pc and by default to target framework was set to 4.5.2.  All versions of .NET up to 4.6.1 are installed on this pc.

Thank you.

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

RE: VC 2.1 to 2.3

Jump to solution

We created support incident 2878817 for this and I was able to reproduce the problem in a small cutdown managed app so I created an RPI for this and sent to development.

There appears to be a problem with the compiler in 2.3 or higher where it is generating incorrect code when there is a constructor containing and open statement and a GO TO. This results in an exception being thrown when the constructor is called that the CLR detected an invalid program.

The cutdown code looks like:

      class-id Amends.

      INPUT-OUTPUT SECTION.

      FILE-CONTROL.

         select test-file assign to "testfile.dat".

      DATA DIVISION.

      FILE SECTION.

      fd test-file.

      01 test-record  pic x(20).

      WORKING-STORAGE SECTION.

      01  XREPLY                       PIC X.

      method-id NEW.

      procedure division.

      IN010.

          OPEN INPUT test-file.

          IF XREPLY = "X" GO TO IN010.

          goback.

      end method.

      end class.

If I comment out either the OPEN statement or the IF statement then the problem does not occur.

If I rewrite the code to use perform instead of GO TO then it also works.

IN010.

          perform until exit

               OPEN INPUT test-file

               IF not XREPLY = "X"

                   exit perform

               end-if

          end-perform

          goback.

I will keep you updated through the support incident.

Thanks.

0 Likes
6 Replies
Micro Focus Expert
Micro Focus Expert

RE: VC 2.1 to 2.3

Jump to solution

It sounds like the instructions for the free trial download may be a bit out of date as all three versions are available for download, 2012, 2013 and 2015.

It is really up to you which version of the .NET Framework you wish to target. Normally users would only target an older version if that specific version was the only one available on their customer machines. Otherwise I would always advise using the latest release supported by the version of Visual Studio you are using.

0 Likes
Highlighted
brendang
New Member.

RE: VC 2.1 to 2.3

Jump to solution

Hi Chris

Thank you for the reply.

So, on the Windows 10 pc I set the Target Framework for every project in the App to .NET Framework 4.5.2.  I now have a problem I need help with:

One project in the App is a Windows Forms project, called from another Windows Form.  This project also contains a class (called Amends) that contains public methods to read to extract information from data files and pass back to the main form.  This class is instantiated from the Form_Load handler of the form.  The constructor in this class opens the data file.  The App is crashing on the line

           set cls-amend to new Amends.

where cls-amends is of type Amends.  The class definition for Amends with constructor is:

       class-id Amends.

       ENVIRONMENT DIVISION.                                            

...

       DATA DIVISION.                                                  

...

       method-id NEW.
       procedure division.

       IN010.
   *>>        Open data file.

           goback.
       end method.

*>> public methods

...

       end class.

When I change the Output Type for this project to Windows Application and run in VS the last three lines of the Output window are:

Exception thrown: 'System.InvalidProgramException' in IPAMENDS.exe
'IPAMENDS.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[8028] IPAMENDS.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'.

The same thing happens when I change the Target Framework back to .NET Framework 4 Client Profile or .NET Framework 4.6.1, or when the project is called from the main App form as a dll.  No code changes have been made from VC 2.1 to VC 2.3, the only thing changed is Target Framework.  I am also puzzled as to why (Managed (v4.0.30319)) appears in the Output Window when the Target Framework is 4.5.2.

I searched for this error and Microsoft says it may be a bug in the compiler.

Other details:

Windows 10 Pro version 10.0.10586 Build 10586

Microsoft Visual Studio Community 2015 version 14.0.25431.01 Update 3

Micro Focus Visual COBOL 2.3 Version 2.3.00134.  Trial version.

Microsoft .NET Framework version 4.6.01038

Platform Target for all projects in App is Any CPU.

Thank you

Brendan

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: VC 2.1 to 2.3

Jump to solution

Hi Brendan,

Managed (v4.0.30319) is referring to the version of the CLR that will be used and not the .NET Framework version.

You say that you get this error even after changing the Framework back to 4.0? Did you get the error prior to changing the target Framework on your original solution compiled with 2.3 update 2?

I think I need to see the entire project so I can test it here. Can you create a support incident for this or zip up the project and email it to me at chris.glazier@microfocus.com?

Thanks

0 Likes
brendang
New Member.

RE: VC 2.1 to 2.3

Jump to solution

Hi Chris

Using VC 2.1 and Framework .NET 4 on Windows XP the project works fine.

We do not have 2.3 Update 2 yet, I am using the 30 day trial of 2.3 and only version 2.3.0 was available as a trial. Will be migrating our development licenses to Windows 10 pc's soon.

I will zip the project and send it to you later today.

Thank you

Brendan

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: VC 2.1 to 2.3

Jump to solution

We created support incident 2878817 for this and I was able to reproduce the problem in a small cutdown managed app so I created an RPI for this and sent to development.

There appears to be a problem with the compiler in 2.3 or higher where it is generating incorrect code when there is a constructor containing and open statement and a GO TO. This results in an exception being thrown when the constructor is called that the CLR detected an invalid program.

The cutdown code looks like:

      class-id Amends.

      INPUT-OUTPUT SECTION.

      FILE-CONTROL.

         select test-file assign to "testfile.dat".

      DATA DIVISION.

      FILE SECTION.

      fd test-file.

      01 test-record  pic x(20).

      WORKING-STORAGE SECTION.

      01  XREPLY                       PIC X.

      method-id NEW.

      procedure division.

      IN010.

          OPEN INPUT test-file.

          IF XREPLY = "X" GO TO IN010.

          goback.

      end method.

      end class.

If I comment out either the OPEN statement or the IF statement then the problem does not occur.

If I rewrite the code to use perform instead of GO TO then it also works.

IN010.

          perform until exit

               OPEN INPUT test-file

               IF not XREPLY = "X"

                   exit perform

               end-if

          end-perform

          goback.

I will keep you updated through the support incident.

Thanks.

0 Likes
Austin1 Honored Contributor.
Honored Contributor.

RE: VC 2.1 to 2.3

Jump to solution
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.