This project was created using Visual COBOL 6.0 and Visual Studio 2019. The objective was to interactively extract data from an indexed COBOL datafile and apply the result to a webform.
To begin,
start up Visual Studio. Select File, New, Project. Select ASP.NET Web Application for COBOL as
the template. Framework should be .NET
Framework 4.6.
Give the
project a name and a storage location. Click Create. This should open up a form.
Go to
Solution Explorer and add the projects LegacyBook and BookWrapper to the
application as well as into the reference of the application. LegacyBook is a procedural COBOL project that
contains the business logic which the form can use. LegacyBook uses COBOL types such as PIC X and
PIC 99V99. The BookWrapper project
converts data from .NET types to COBOL types.
Note that
LegacyBook requires a copybook (book-rec.cpy) and so does the BookWrapper
project (book-rec-dotnet.cpy).
At this point, it is time to paint the Webform. Painting the labels, buttons and textboxes on to the form was done by direct coding in the Default.aspx file and not by dragging and dropping them from the Toolbox. The attachment below shows the Default.aspx file with the coding for this project.
The Default.aspx file showing the coding for the webform |
Once the form has been drawn, it is time to add the following code to the Web.config file.
The Web.config file |
Note that
the indexed COBOL data file (bookfile.dat) is added to the Web.config file.
Next add the
following code in the Default.aspx.cbl file.
The Default.aspx.cbl file that activates all the controls on the form |
The completed webform with a search result for book number 2222 |
The form
should be filled up with the results of the search. The following shows a search for book number
2222.
No comments:
Post a Comment