Transcript Slide 1
COBOL and Distributed Architecture
Boris Gilad
COBOL Solutions Manager
[email protected]
[email protected]
Agenda
Object Oriented COBOL
COBOL - Java interaction
COBOL and XML
COBOL and Web Services
COBOL and EJB
COBOL.Net
Q&A
COBOL and others - then and now
Past
From COBOL
To COBOL
Call Using
Linkage Section
Call “System”
Invoking from command line
Present
COBOL-RPC
COBOL-CGI
CORBA
Future
OO COBOL
COBOL RTS as OO Class
COBOL XML
COBOL XML
Consuming WS from COBOL
Exposing COBOL as WS
Exposing COBOL as EJB
.Net
.Net
Object Oriented COBOL concepts
Objects and Classes
Object References
Predefined Object References
Methods
Method Invocation
Interfaces
Polymorphism
Class Inheritance
ETC, ETC, ETC
Object Oriented COBOL demo program
Calling Java from COBOL
Access JDBC Data Sources from COBOL
Send messages to Java Objects from
COBOL using the Java Domain
Calling Procedural COBOL
from Java
Access existing COBOL assets from
Java using mfcobol.runtime class
Calling Object COBOL from Java
Access COBOL objects from Java Programs
Wizard generates Java wrapper class
Micro Focus COBOL/XML Syntax
Provide a higher level COBOL orientated approach to
COBOL/XML
Adds significant new syntax to handle XML documents to
consume, create, update and XML documents from COBOL
• Based on familiar approach used with COBOL I/O support
• Provides both SAX style or DOM style parsing
Map to/from XML W3C Compliant Schemas
COBOL
Record
CBL2XML
XML
Schema
Micro Focus Syntax - SELECT
SELECT statement is the foundation
Just like COBOL File I/O
SELECT xml-bookdb ASSIGN "c:bookrw.xml“
ORGANIZATION IS xml
DOCUMENT-TYPE IS "bookdb.xsd"
FILE STATUS IS xml-bookdb-status.
Micro Focus Syntax - XD
XD stucture - the association between XML and COBOL records
xd xml-bookdb.
01 xml-bookdb-query
identified by "query“.
03 xml-book occurs 3 identified by “book”.
05 xml-bq-author
pic x(40) identified by "author".
05 xml-bq-title
pic x(40) identified by "title".
represents an XML document that has structure:
<query>
<book>
<author>Author Name</author>
<title>Book Title</title>
</book>
<book>
<author>Author Name</author>
<title>Book Title</title>
</book>
</query>
Micro Focus Syntax – Basic Verbs
OPEN {input|output|i-o} file-name
• surprise, surprise, surprise
READ file-name
• Read entire XML document
WRITE file-record
• Write entire XML document
CLOSE file-name
• more surprises…
COBOL XML Demo
What is Service?
What Service do I provide?
What Input do I receive?
What Output do I return?
Where to find me?
COBOL Program as Service
linkage section.
01 lnk-function
pic x.
88 read-record
value "1".
88 add-record
value "2".
88 delete-record
value "3".
88 next-record
value "4".
01 lnk-file-status
pic xx.
01 lnk-details.
03 lnk-text-details.
05 lnk-title
pic x(50).
05 lnk-type pic x(20).
05 lnk-author pic x(50).
03 lnk-stockno pic x(4).
03 lnk-retail
pic 99v99.
03 lnk-onhand
pic 9(5).
03 lnk-sold
pic 9(5) comp-3.
COBOL Program as Service
Service Read_Record
lnk-function = 1
Input
lnk-stockno
Output
lnk-file-status
lnk-text-details
lnk-retail
lnk-onhand
lnk-sold
Service Add-Record lnk-function = 2
Input
lnk-stockno
lnk-text-details
Output lnk-file-status
Service DeleteRecord
lnk-function = 3
Input
lnk-stockno
Output
lnk-file-status
Service Add-Record lnk-function = 2
Output lnk-file-status
lnk-stockno
lnk-text-details
lnk-retail
lnk-onhand
lnk-sold
Interface Mapping Toolkit (IMTK)
COM
Non-ES
Windows only
Generation
EJB
Interface
COBOL
Interface
(Linkage Section)
Web
Services
Test
Client
Deployment
Java
Application
Server
Enterprise
Server
Direct COBOL Web Services
The ability to Create, Consume and Deploy COBOL Web services
without requiring any 3rd Party Software
Create
• New tool in Net Express 4.0 called the Interface Mapping Toolkit
builds a Web service from an existing COBOL Interface
Consume
• COBOL can access a Web service built not only with Net
Express but say .NET or IBM WebSphere
Deploy
• Direct COBOL Web services can be deployed with Enterprise
Server
Complete COBOL Web services Solution
‘Direct’ COBOL Web services
Net Express/Server Express Enterprise Server
SOAP/HTTP
SOAP
Listener
Workload
Dispatcher
Insurance
Broker
application
Users COBOL
programs
Decode
Server
Pool
Generated by
Interface Mapping
Toolkit
No Java footprint on the server
Mapping COBOL Programs as EJB
COBOL
Program
Interface
Mapper
IDT
Checker
INT
Data Dict.
XML
Map. XML
EJB, JSP and
Servlet Generator
EJB
Classes
Servlet
Classes
JSP
Enterprise Server –
Transaction Processing
Enterprise Server defines a COBOL Container for UOW
transaction execution
• Follows the ‘Container Managed Transaction’ model
• No explicit syntax required
• Transaction characteristics defined when deployed
Web services transactions are single-phase stateless
transactions
Supports Micro Focus ISAM and ‘leading’ RDBMS
Acts as a resource manager to J2EE XA transaction
protocols
COBOL Inside the .NET Framework
C#
…
VB.NET
.NET Framework 2.0
Framework
Classes
ADO.NET
Winforms
Webforms
Win32
COBOL Development
Micro Focus
Application Server
Visual Studio 2005
Net Express 5.0
MSIL (Intermediate Language)
Common Language Runtime
COBOL
COBOL Deployment
COBOL – an equal player in .NET
COBOL
generates IL as other Microsoft languages
COBOL is deployed inside the .NET Framework under the CLR
COBOL gains access to Framework classes and functionality
Visual Studio 2005 Integration
Colorization in COBOL editor
distinguishes reserved words, data
names, comments, etc.
Intellisense lists method-name choices
•Productive COBOL
Development and
extension with Visual
Studio
•Develop composite
.NET
COBOL/C#/VB.NET
applications using
same IDE
•Access .NET
Framework from
COBOL
COBOL compiles to managed or verifiable code
Solution contains multiple projects, one for each programming
language involved. This solution involves COBOL and C#
.NET WinForms and WebForms
in COBOL
Win Form painter with
Properties dialog box
Use Visual Studio
Painter to create and
maintain windows
forms and web
pages to interact with
existing COBOL
programs
COBOL code is created to support
the Win Form.
Win Form with data during
program execution.
Solution Explorer shows entire web site
Web Form screen designer
Toolbox for adding controls to Web form
COBOL code behind the Web form
Web Form with data during execution
Create, Reuse and Extend
Reuse existing COBOL Business logic in .NET
Use Procedural or Object Oriented COBOL under
.NET
Extend COBOL applications to utilize .NET
functionality
- Access to .NET Framework Classes
program-id. ShowMessageBox as "ShowMessageBox".
environment division.
configuration section.
repository.
class Message-Box as "System.Windows.Forms.MessageBox".
data division.
working-storage section.
procedure division.
invoke Message-Box "Show" using "Hello COBOL World".
end program ShowMessageBox.
Connected and Disconnected
Data Access
Connected Data Access
RDB
ISAM
Read / Write
Application
Disconnected Data Access
Application
COBOL, C#,
VS.NET Program
Download
RDB
ISAM
Dataset(s)
Upload
COBOL, C#,
VB.NET Program
ADO.NET provides for
Connected and Disconnected
data access
Disconnected data access
liberates SQL application from
a continual connection to a
database
Enhance the performance of
web and other applications
Share data across composite
applications
Make ISAM and other data
available to non-COBOL
applications
Export data to XML
Expose COBOL as Web Services
Use Visual Studio .NET to create and extend COBOL applications
CLASS-ID. Stock INHERITS WEBSERVICE.
REPOSITORY.
CLASS WEBSERVICE AS "System.Web.Services.WebService"
CLASS WEBMETHOD AS "System.Web.Services.WebMethodAttribute".
OBJECT.
PROCEDURE DIVISION.
METHOD-ID. StockQuote CUSTOM-ATTRIBUTE IS WEBMETHOD.
COBOL
ASP.NET
Microsoft IIS
COBOL
Application
COBOL.Net demo program
Summary
?????????????? ?????
????????????
?????????????????????
??????????????
?????????????
Q&A
VIVA COBOL !
Thank You