Highlighted
Absent Member.
Absent Member.
2018 views

Visual Cobol Compile Error

Just installed Visual Cobol and was working through the course to learn to use it.  When I got to the WebDemo program I get the error Message that says "Make sure that the class defined in this code file matches the "inherits" attribute, and that Default.aspx.cbl it extends the correct base class (e.g. Page or UserControl)."  So to see what the issue was I created a blank one, much to my surprise I received the same results.  I am using Visual Studio 2012 and the latest Visual Cobol Personal Edition.  Any help would be appreciated. 

Below is the code

class-id _Default is partial
                 inherits type System.Web.UI.Page.

       working-storage section.

       method-id Page_Load protected.
       local-storage section.
       procedure division using by value param-sender as object
                                         param-e as type System.EventArgs.
           goback.
       end method.


       method-id btnOK_Click protected.
       01  name-entered     pic x(20).
       01  response         pic x(20).
      
       procedure division using by value lnkSender as object lnkEvent as type System.EventArgs.
           move txtName::Text to name-entered
           string "Hello " delimited by size
                  name-entered delimited by space
               into response
           move response to lblResponse::Text   
           .      
       end method.

       end class.

Below is the Default.aspx

<%@ Import Namespace="System.Web.UI.Page" %>

<%@ Page Language="COBOL" AutoEventWireup="true"  CodeFile="Default.aspx.cbl" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div id="MyForm">
   
        <asp:Label ID="lblIntro" runat="server"
            Text="Please enter your name and press OK"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
        <br />
        <br />
        <br />
        <asp:Button ID="btnOK" runat="server" onclick="btnOK_Click" Text="OK" />
&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Label ID="lblResponse" runat="server" ForeColor="Red"></asp:Label>
   
    </div>
    </form>
</body>
</html>

0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Visual Cobol Compile Error

This appears to be a problem when using the Visual Studio 2012 Shell and trying to create an ASP.NET Web Site. This works fine when using a full version of Visual Studio 2012 like professional, premium, etc. but fails when using Visual Studio 2012 Shell.

You should be able to create an ASP.NET Web Application using New-->Project-->Web but the Web Site type of project is failing.

I would recommend either using a full version of Visual Studio 2012, using the ASP.NET Web Application template instead of the Web Site or just skipping this section of the learning guide until a fix becomes available.

Sorry about that...

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Visual Cobol Compile Error

Chris, I have Visual Studio Professional 2012 Version 11.0.50727.1 RTMREL.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Visual Cobol Compile Error

Yes, I tried this on a different computer using Visual Studio 2012 Premium and was able to reproduce the problem so it appears to be related to specific environments instead of the Shell version.

I am investigating.

Thanks.

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.