1 / 23

Creating Web Services for Legacy COBOL Craig A. VanLengen John D. Haney

Next. Creating Web Services for Legacy COBOL Craig A. VanLengen John D. Haney College of Business Administration Northern Arizona University. Research Objective. Next. To place a “legacy” COBOL program into a Web Service To reference, and use, the Web Service from Windows Application

salma
Download Presentation

Creating Web Services for Legacy COBOL Craig A. VanLengen John D. Haney

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Next • Creating Web Services for Legacy COBOL • Craig A. VanLengen • John D. Haney • College of Business Administration • Northern Arizona University

  2. Research Objective Next • To place a “legacy” COBOL program into a Web Service • To reference, and use, the Web Service from • Windows Application • Web Application

  3. Development Environment Next • Microsoft Visual Studio .NET 2003 • MicroFocus NetExpress

  4. Function of the “Legacy” Program Next • Update an Indexed Sequential Master File, in batch mode • Add records • Change records • Delete records • Provide a completed message • Transactions are provided in a transaction file

  5. Interaction of Client with the Web Service Next • The Client provides the name of the transaction file to the Web Service. • The Web Service returns: • A count of records Added • A count of records Changed • A count of records Deleted • A completion message • The Client displays the counts and the message.

  6. System Overview Next

  7. Required Changes to “Legacy” Program Next Linkage Section. 01 lnk-FileName Pic X(80). 01 lnk-addCount Pic 9(6). 01 lnk-chgCount Pic 9(6). 01 lnk-delCount Pic 9(6). 01 lnk-txtMessage Pic x(50). Procedure Division using lnk-FileName lnk-addcount lnk-chgCount lnk-delCount lnk-txtMessage. Exit Program. Move lnk-FileName to 400-FileName. Move 400-Add-Count to lnk-addCount. Move 400-Chg-Count to lnk-chgCount. Move 400-Del-Count to lnk-delCount. Move "Update completed successfully!" to lnk-txtMessage.

  8. Proxy or Wrapper Class Next CLASS-ID. cblProxy As "cblProxy". REPOSITORY. CLASS StringClass As "System.String" CLASS dataObject As "dataObject“ . STATIC. DATA DIVISION. PROCEDURE DIVISION. METHOD-ID. CallUpdateProgram As "CallUpdateProgram". Local-Storage Section. 01 lo-DataIn. 05 lo-FileName Pic X(80). 01 lo-DataOut. 05 lo-Message Pic X(50). 05 lo-Added Pic 9(6). 05 lo-Changed Pic 9(6). 05 lo-Deleted Pic 9(6). LINKAGE SECTION. 01 lnk-FileName Object Reference StringClass. 01 lnk-dataObj Object Reference dataObject. PROCEDURE DIVISION Using by value lnk-FileName Returning lnk-dataObj. SET lo-FileName to lnk-FileName. CALL "cblUpdate" USING lo-FileName lo-Added lo-Changed lo-Deleted lo-Message . Invoke dataObject "New" Returning lnk-DataObj. Set lnk-dataObj::"ReturnMessage" to lo-Message. Set lnk-dataObj::"ReturnAdded" to lo-Added. Set lnk-dataObj::"ReturnChanged" to lo-Changed. Set lnk-dataObj::"ReturnDeleted" to lo-Deleted. END METHOD CallUpdateProgram. END STATIC. END CLASS cblProxy.

  9. Data Object Class Next Identification Division. Class-id. dataObject As "dataObject". Environment Division. Configuration Section. Repository. Class DecimalClass as "System.Decimal" Class StringClass as "System.String" . Object. Data Division. Working-Storage Section. 01 ReturnMessage Object Reference StringClass Property as "ReturnMessage". 01 ReturnAdded Object Reference DecimalClass Property as "ReturnAdded". 01 ReturnChanged Object Reference DecimalClass Property as "ReturnChanged". 01 ReturnDeleted Object Reference DecimalClass Property as "ReturnDeleted". End Object. END CLASS dataObject.

  10. C# Client Code Next private void btnUpdate_Click(object sender, System.EventArgs e) { COBOLWSClient.localhost.cblUpdateServ myUpdate = new COBOLWSClient.localhost.cblUpdateServ(); updateAdded = Convert.ToInt32(myUpdate.CBLUPDATE(strFileName, out updateChanged, out updateDeleted, out retMessage)); txtAdded.Text = Convert.ToString(updateAdded); txtChanged.Text = Convert.ToString(updateChanged); txtDeleted.Text = Convert.ToString(updateDeleted); txtMessage.Text = Convert.ToString(retMessage); btnUpdate.Enabled = false; }

  11. Visual Studio with the Windows Client Next

  12. Add Reference Dialog Next

  13. Add Web Reference - Web Service Next

  14. Execution of the Windows Client Next

  15. Interface Mapper Next The Interface Mapper generates an input and output field for each field that will interact from the COBOL program.

  16. Enterprise Server Administration Tool Next The Web Service is deployed using the Micro Focus Enterprise Server.

  17. Deployment Settings Next Set the Web Service deployment settings.

  18. CobolService.WSDL file Next This file defines the web service and provides for interaction with the Web Service. • - <!-- • Micro Focus NetExpress 4.0 auto-generated WSDL document   --> • - <types> •   <schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/cblUpdateServ" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/cblUpdateServ" /> •   </types> • - <message name="CBLUPDATEInput"> •   <part name="lnk_filename_in" type="xs:string" /> •   </message> • - <message name="CBLUPDATEOutput"> •   <part name="lnk_addcount_out" type="xs:int" /> •   <part name="lnk_chgcount_out" type="xs:int" /> •   <part name="lnk_delcount_out" type="xs:int" /> •   <part name="lnk_txtmessage_out" type="xs:string" /> •   </message>

  19. Computerworld, October, 09, 2006 Next • COBOL’s Batch Advantage • COBOL: Not Dead Yet • COBOL Coders: Going, Going, Gone?

  20. Computerworld, October, 09, 2006 Next • What programming languages do you use in your organization? Choose all that apply. •  Visual Basic - 67% •  Cobol - 62% •  Java - 61% •  JavaScript - 55% •  VB.Net - 47% •  C++ - 47% •  Perl - 30% •  C - 26% •  C# - 23% • Source: Computerworld survey of 352 readers

  21. Computerworld, October, 09, 2006 Next • Cobol is a procedural language in an object-oriented world. • While it's well suited to batch operations, the language isn't as good a fit for developing interactive applications or Web-based front ends. • And it has a major image problem. Outside of the mainframe data center, Cobol is viewed . . . as an obsolete and inferior language, a vestige from the dark ages of big iron.

  22. Summary Next • COBOL batch programs can be placed into a COBOL Web Service and executed from a Windows or Web application. • This would fit most appropriately into high level (Senior) web development class.

  23. Creating Web Services for Legacy COBOL • Craig A. VanLengen • John D. Haney • College of Business Administration • Northern Arizona University

More Related