Oracle Modernization Solutions
上QQ阅读APP看书,第一时间看更新

Which Legacy Artifacts Should I Expose? — Using the Relativity Product Set

In Chapter 3, we covered the concepts of SOA Integration and how to discover the legacy artifacts to expose services. Without repeating from this chapter, the SOA Integration Scenario starts with a detailed technical example on how to discover the VSAM file to be expose, as well as the components that facilitate access to them. Before we do that, we must get introduced to the Relativity tool set, terminology definitions, and tools overview. The Relativity tool set is used heavily in our example.

The complexity of existing legacy applications makes the task of identifying potential services for exposure in an SOA architecture quite difficult. The difficulty varies based on the layering degree of the application. We will discuss layering in more detail shortly. It is simpler to identify and expose legacy artifacts as Web services for a well-layered application and more difficult for a non-layered application. It is simpler to identify and expose legacy artifacts as Web services when programs use simple communication areas, and more difficult when these communication areas are complex and consist of a large number of unused fields.

To expose a service, we must solve a number of problems:

  • Which programs are suitable for exposure?
  • Which programs contain the desired functionality?
  • What is the best level of granularity for the service exposure?
  • How to proceed when the desired functionality is intermixed with other functionality?
  • How to select the essential fields in the communication areas?
  • How to perform minimum intrusive changes to the application code, if such changes are needed for service exposure?

To solve these problems, we will use a number of specialized tools:

We will start with a discussion of the application layers, which is relevant for all subsequent points.

Application Layers — Understanding Relativity Terminology

Building an application with distinct layers is not a new concept. Even for old applications, architects have understood the benefits of placing the artifacts in well-defined layers (referred to as tiers inChapter 3). In a perfectly layered application one may distinguish the following layers:

  • Layer 0 — User interface layer

    This layer consists of screens which would be visible to the users. This is the user interface.

  • Layer 1 — Client layer

    This layer consists of all programs that communicate directly with the screens. This is the presentation tier and/or the navigation tier.

    Such programs would contain all the logic for capturing users' requests, validating the input data, invoking the appropriate "service" programs from the lower layers and formatting the output that responds to the user's request.

    In this layer, the execution moves to the lower layers via CALL or LINK operations, and moves to other programs of the same layer via exclusive transfer of control, which in CICS could be accomplished by XCTL or RETURN TRANID statements.

    In fact, this layer may contain two types of programs:

    • "Client programs" that receive and send screens
    • "Transitional programs" that make navigation decisions

    Transitional programs are sometimes used as traffic dispatchers. A program CPROG1 may receive a screen, SCREEN1 and pass exclusive control to a program TPROG that analyzes the user request in order to decide the next screen to be presented to the user. TPROG may pass exclusive control back to CPROG1, which in turn may present the same screen, SCREEN1, with additional data that satisfies the request. TPROG may also decide to transfer control to a program CPROG2, which in turn may present the screen SCREEN2.

    The benefit of transitional programs is that they encapsulate the navigation logic. The client programs are confined to screen logic, while the transitional programs are confined to navigation logic.

  • Layer 2 — Service layer

    This layer consists of all programs that satisfy a request, without any screen communication or regard to screen logic. Most programs in this layer interact in one way or another with application's persistent data, but they may also perform certain pure logic related to computation, or formatting. As an example, one "service" program may retrieve invoice information based on an invoice number, or it may simply compute the number of business days between two dates.

    Service layer programs may be also classified based on their position in the calling hierarchy, resulting in three categories:

    • Layer 2A: Frontier programs that are called directly by Layer 1 programs
    • Layer 2B: Indirect data access programs, which access data through some other called service programs, or perform computations or formatting
    • Layer 2C: Direct data access programs, which access the persistent data from VSAM files, or from databases
  • Layer 3 — The database persistence tier.

A classification of assets in a perfectly layered application is illustrated in the following hierarchy, as displayed by the Relativity's SOA Analyzer tool:

Application Layers — Understanding Relativity Terminology

In the case of a well-layered application, programs in each layer will have well-designated business functions:

  • Client programs contain screen logic
  • Transitional programs contain navigation logic
  • Frontier programs contain business level data manipulation logic
  • Sub-frontier programs contain both business logic and technical data manipulation logic

The layering of the application is of immediate importance in an SOA enablement project. As we try to expose services that execute discrete requests, we will look at the client and transitional programs only for the purpose of identifying the location of potential services. In themselves, they do not offer services, as they do not execute any server type logic. Their functionality will be replaced in an SOA architecture with new technical artifacts that are "end-user facing", and implemented practically on an application or web server.

The service programs are the ones offering "service" capability, and we can create Web services based on their functionality.

Note

Keeping It Real: Classification and layering of your application assets is valuable in itself. For many organizations, it is the first time they take a complete inventory of their applications, including a classification of all their application artifacts.

Understanding an Artifact's Place in the Architecture

The simple classification of application artifacts does not give us a full understanding of how they are used. The SOA Analyzer provides a more detailed picture when we ask for 'vertical' and 'horizontal' slices that show the context in which the artifact is used. Such 'slices' are very useful, as a complete diagram of the application may be exceedingly complex and hard to understand.

A vertical slice shows "usages", that is, how an artifact is used (for instance via a call or a file access), and how it uses other artifacts. Vertical slicing is the method used to determine the modules that access data files. Vertical slicing is also used to determine 'frontier programs', programs that contain business logic. Both these modules make great candidates for enabling as services. A 'horizontal' slice shows how the control passes between artifacts, usually through exclusive change of control, or through screen navigation. Horizontal slicing is a great way to determine the modules that can be exposed from your presentation-tier (client layer).

Vertical Slices

We can obtain the vertical and horizontal slices by a right-click on an artifact in the Classification pane, followed by the selection of the Show vertical slice or Show horizontal slice menus. Now, let us look at certain examples.

Vertical Slices

As a CICS transaction appears in the highest layer of the architecture, it is not itself "used" by any another artifact. In the above figure, we can see that transaction RWCD is started by program RWCP1198, which calls RWCP1200, RWCP116, and RWCP1202. In turn, the last two programs access certain files (shown at the very bottom of the diagram) in read mode (R), Read/Update (RU), or Read/Update/Insert mode.

Vertical Slices

The preceding figure shows a vertical slice of the screen RWCS80A, which is sent and received by the program RWCP110, and sent only by program RWCP1132. These programs then call programs RWCP1138 and RWCP1156 to read data sets.

Vertical Slices

The above figure shows a vertical slice of program RWCP1136. We can immediately notice that this happens to be a 'frontier' program, according to the classification that we have described earlier, as it does not access screens and is called directly by programs that access screens. This special position in the architecture would make it a good candidate for exposure as a Web service.

Vertical Slices

From the preceding figure, we can discover a fact that is relevant in the effort to extract services — all operations against the selected file (seen at the bottom, in a white box) are performed via a single program, RWCP1120. This makes the program ideal as a service, as it certainly contains all the logic needed to access the file from outside.

Note

Keeping It Real: Vertical slicing shows the usage of modules from the presentation-tier through the business logic, down to the data files, and to the modules that access these data files. Vertical slicing is therefore incredibly useful in identifying business logic and data access module to expose as services.

Horizontal Slices

While vertical slices through the application's architecture show usage scenarios, horizontal slices show the processes or workflow performed by the operator. Horizontal slices do not make sense for files or tables of other persistent data artifacts, as they do not represent processes or actions triggered by the user. For programs, horizontal slices show the exclusive change of control from one program to another, as for example via XCTL operations in CICS. For screens, they show the possibilities for the operator to move from one screen to another.

We can look at some examples of horizontal slices.

Horizontal Slices

The preceding figure shows a horizontal slice for the screen RWCSA8. The block on the left shows all the screens from which the operator can potentially move to this screen, while the block on the right shows all the screens to which the operator can potentially move from this screen.

I have intentionally used the word "potentially", because not all these transitions may happen at runtime. The simple reason is that the static analysis cannot always discover the exact transitions, due to the fact that they may be controlled deep in a program or even in a file or table. In some legacy applications, the traffic between screens is recorded in a table which a traffic cop program reads in order to figure out how to process a user request. The preceding figure should be interpreted as "from screen RWCSA8 one can possibly move to screens RWCSA3, RWCSA5 and RWCSA8." In reality, the program that controls RWCSA8 may contain additional restrictions, which prevents, for example, a move to screen RWCSA8.

Note

Keeping It Real: Horizontal slicing shows the modules usage from the perspective of the client and the transitional layers (screens and navigation tiers). Horizontal slicing is therefore incredibly useful in identifying the points or steps in the process where certain services are invoked.

Horizontal Slices

The preceding figure shows a horizontal slice of programs. Every edge in the graph indicates an exclusive change of control from one program to another program.

Together, horizontal slices and vertical slices offer a good picture of the role of a particular artifact in the application architecture.

Understanding Anomalies

In the real world, many legacy applications exhibit various exceptions from the layering scheme described earlier. The SOA Analyzer tool will identify these exceptions, which sometimes need to be addressed in one way or another to allow an SOA enablement by exposing all potential services offered by the legacy application.

We are going to call such exceptions "anomalies", and it is important to notice that they do not represent errors or mistakes. Programs with anomalies (as they are understood here) may function perfectly as they were originally intended, but present difficulties when it comes to a transition towards to an SOA architecture, as you will see.

In all the diagrams presented by the SOA Analyzer, programs with anomalies are shown with a red background. A click on a node for such a program will display the properties pane, where the anomaly is clearly stated, as shown in the following figure:

Understanding AnomaliesSOA Analyzerhorizontal slices

There are four types of anomalies that the SOA Analyzer identifies.

Client Programs with Data Access

In a perfect architecture, all programs that belong to the client layer should only deal with screen logic and navigation. Data access should be accomplished through the programs belonging to the frontier and sub-frontier layers, which in turn should be called by the client programs. This is the case in a well-layered application. But in real life, this restriction is not always enforced. In some cases, where no strict architectural discipline is enforced, programmers may take shortcuts and combine the screen access and data access in the same programs, as it is shown in the following vertical slice for program CUSTINQ1:

Client Programs with Data AccessSOA Analyzeranomalies

As I have already stated, although a program like CUSTINQ1 may function very well, it may present some limitations when it comes to the mining of services. Let us suppose that this program contains some very special logic that interprets the data read from the Customer Master file. It is possible, for example, that the program reads the date of birth of a customer and calculates the age, which is then displayed on the screen. Many such derivations are possible. We would like to have a service that does not just read a record from the Customer Master file, but also interprets and derives new data items. Unfortunately, while CUSTINQ1 does the interpretation and the derivation, it cannot be simply made into a service, as it is also conversing a screen (by definition, a service cannot do that). We will discuss later what can be done in such a case.

Note

Keeping It Real: Legacy applications are not the only ones that contain database access in client facing modules. Often, Web developers will include JDBC calls directly in JSPs. We will be found guilty of this later on in this chapter. Our example has JDBC calls in a JSP, which is not a recommended practice for production systems, but we will use the excuse that this is just sample/example code!

Calling Client Programs

It is tempting to look at all programs that are called as potential services. In principle, a call is a request to the called program to perform a task, and that is also the nature of a service. However, in real life applications, we will, encounter situations where a called program cannot be made into a service for a simple reason that it also converses a screen, as can be seen in the following figure, with program SYSTEM.PCITN100:

Calling Client Programs

There can be many reasons why the original application included this anomaly. Perhaps the most common reason is that when a "service" program is written the programmer finds it convenient to report an exception immediately to the operator by sending a screen with a message. By writing the program in this style, the programmer simplifies the code, but renders it unfit to become a Web service (which by definition cannot converse with a user interface).

If the program in question is desired as a service, it should be modified such that instead of sending a screen in case of an exception, it should return to its caller with a special return code signaling the same exception.

Calling Transitional Programs

This anomaly is mostly theoretical, as transitional programs are not usually candidates for services. However, it signals a strange situation, in the sense that usually transitional programs (as defined above) are mostly dedicated to directing the screen navigation, and not to the fulfillment of a task (typical for called programs).

Impure Service Programs

This is a generalization of the "Client programs called" anomaly. It happens when a client program calls a "service" program, which in turn calls another client program. Although the one in the middle seems to be a perfect service (because it is called, and does not converse a screen), it is impossible to turn it into a service, as during the execution one of its called programs converses a screen.

In the figure under the heading Calling Client Programs, this is the case with the program CRMODL.GRQUN900, which is "almost" a service. This program is called by CRMODL.GRQUN600, but in turn calls SYSTEM.CRTXN06, which calls SYSTEM.PCITN100, which is actually a client program conversing the screen SYSTEM.PCITM100.

Other Anomalies that Need Remedial Action

There are some other challenges we need to overcome in order to expose services from a legacy application. Programs that appear as perfect candidates for services may display certain characteristics that need remedial action.

Data Validation Problem

A perfect CICS service program may not become a perfect Web service due to the fact that it fails to perform data validations. That may not be a problem in its original environment as it relies on its caller program to perform such validations. Let's have a look at the following figure:

Data Validation Problem

Next to the ORDERR1 program, you can see a label with the text, "7 validations". This label appeared automatically after:

  • We used Relativity's Business Rule Manager, where we made a request to automatically detect all screen validations in program ORDERR1.
  • We pressed the Tools | Intersect Validations menu in the SOA Analyzer.

The "7 validations" label indicates that as ORDERR1 converses the screen ORDMAP1, it performs 7 validations against the data entered by the operator on this screen. Such validations check if the data is numeric, properly formatted, or entered in the mandatory fields. When program GETINV is invoked to perform an operation against the INV.CONTROL file, it assumes that all data is already valid (otherwise ORDERR1 would have issued a warning message to the operator). GETINV can now fulfill the requested tasks without the danger of running into some data that does not make sense.

Although GETINV is otherwise a good candidate for a service, here is the caveat! If this service is invoked from another environment other than its original one, there is no guarantee that the data it receives is valid. What worked perfectly in CICS may not work properly in SOA architecture.

There are various remedies we can apply to resolve this issue. One of them could be that the application server or even the client facing programs in the new architecture perform the validations and ensure that GETINV does not receive anything else other than correct data. Another remedy is to repeat the same validations in GETINV as they exist in its caller, ORDERR1, and have GETINV return with a special return code, should these validations fail.

Note

Keeping It Real: Placing the data validation in your new JSP, JSF, or AJAX application is easily achievable. However, it defeats the purpose of using Legacy SOA Integration as a 'limited coding' modernization approach. However, if your strategic direction is to re-architect your system, you may see writing the data validation in Java EE as your next step toward moving off the mainframe.

The Problem of Transient or Temporary Data Queues

One would usually expect the caller and called programs in a CICS environment to communicate through the CICS COMMAREA. This is the most common way, but not the only way, in which CICS programs pass data. It is also possible that the called program writes the data into a temporary storage queue that the caller reads. As most CICS adapters are equipped to deal only with data passing through COMMAREA, this creates a major difficulty.

We need to discover if such situations exist. It is in fact quite simple. After we display a vertical slice through the architecture (see the description of vertical slices above), we press on the Tools | Intersect Queues menu. This will add labels next to the programs that operate with queues, as shown in the following figure:

The Problem of Transient or Temporary Data Queues

This diagram tells us that GETINV writes to a queue and ORDENT1 reads from a queue. It is just a red flag at this point, enough to determine us to investigate. If we really find that the data passes from GETINV to its caller via the queue, then we know that normal service adaptors would not be able to create a good service out of GETINV. When the program is called as a Web service in SOA architecture, the service consumer will expect to collect all the data from the service interface that describes the COMMAREA, while the data actually resides in a queue.

The remedy is to either modify GETINV to pass the data exclusively through the COMMAREA, or to create a special 'service' program that reads the queue and passes it through the COMMAREA. Finally, it is possible that some vendors offer service adapters that are capable of getting the data from CICS queues.

Finding the Service Functionality — Relativity SOA Analyzer Product

As service programs capable of exposure are themselves placed in sublayers, the question is which one to choose. Given that we may look for a particular service function (for example, "retrieve claim"), we need to narrow the search to those that are related to this function, in one way or another. The development team maintaining the application may simply know which are the programs implementing the function. In the absence of such direct knowledge, we can use other methods to find the functionality we want to expose.

Starting from Screens

One such method is to start with the screens that suggest the functionality that we are after. By inspecting the screens, for instance, we may discover that one of them helps the operator perform an Order Entry function. Screens may be viewed in the SOA Analyzer by selecting the View Source menu visible when we right-click on a screen mode. Our Order Entry function will display as follows:

Starting from Screens

Once we discover the screen that deals with the service function, we can look at its "vertical slice" through the application. The vertical slice, as displayed by the SOA Analyzer, shows a cut through the layers, which includes the screen as well as all the programs that service it, as shown in the following figure:

Starting from Screens

In this diagram, we can see that the screen ORDMAP1 (which appears on the top) is accessed by the program ORDENT1, which in turn calls other programs to fulfill a request. All these called programs are candidates for services. Together, they could become operational in a Web service that would be consumed when one makes a request to create a customer order in the new SOA architecture.

As we look for potential service programs, we should give special attention to the frontier programs. Indeed, they encapsulate the most complete functionality. They not only know which data to access, but also know how to assemble it in a manner consistent with business requirements. If lower-layer programs are selected, then some of the data assembly must be performed on the application server, opening the possibility of erroneous implementations that differ in functionality from the original application. Choosing frontier programs for exposure makes the task simpler and eliminates the possibility for further errors.

Looking for Special Program Constructs

Another method to find the services with a particular functionality is to look for special patterns in the code. This can be accomplished from the Relativity's Application Analyzer with the aid of the so-called clipper queries.

To run a clipper query, we'll go through the following steps:

  1. Select a program in the SOA Analyzer, right-click on it, and press the Show Source menu. The source of the program appears in a pane of the tool, as shown in the following figure. If you press on the top-right button, a menu appears where you select Clipper.
    Looking for Special Program Constructs
  2. A new pane opens up in the Source pane. Press the corresponding toolbar button to create a New list (this is where the results of the query will be deposited).
    Looking for Special Program Constructs
  3. A new pane opens up in the source pane, on which you can locate the search button and select Cobol File sources as the space where we are going to search, as shown in the following figure :
    Looking for Special Program Constructs
  4. We get a new window on which we can build our query. Clipper queries allow us to interrogate any type of program construct as well as combinations of such constructs. In this case, we can build a very simple query that looks for variables containing the string INV, hoping to find the places where an invoice is updated. The intention is to isolate the program that maintains invoice data. The query appears as shown in the following figure:
    Looking for Special Program Constructs
  5. After we press the Find All Constructs button, a search is performed, and the results are stored in the new list that we have created, called Invoice. We can, at any point in time, inspect this list and visit all occurrences of the INV string in a variable name. We can, of course, write down the name of the programs that contain such occurrences, but can also ask the SOA Analyzer to "intersect" any diagram with this list. This will show which programs included in a diagram contain occurrences from the list.
  6. In order to intersect a diagram with a list of program constructs obtained from a Clipper query, we first display the diagram, and then select the Tools | Intersect list menu. We are prompted with a list of all existing lists, as shown in the following figure, of which we select one (in this case, the one called Invoice, which we have just created).
    Looking for Special Program Constructs
  7. As a result of a selection, SOA Analyzer creates labels for all programs in the current diagram that contain items from the list. The text of the label indicates the number of occurrences, as shown in the following figure:
    Looking for Special Program Constructs

This entire search points to GETINV as a good candidate for the desired service. It performs some operations with the Invoice, and it is a service type program that does not converse any screen.

Note

Keeping It Real: The Clipper query is also very useful while doing a modernization re-architecture project. Often, you will want to determine all the modules that access a particular data element or data file. This is done in order to get an idea of how isolated a particular data element is from access by other systems.

The Case of Mixed Programs — Program 'Slicing'

Sometimes, the functionality we want to expose is found in a client program. Unfortunately, the client program cannot be called as a service as it contains screen communication as well as screen logic that does not make sense in a service call.

There are at least two solutions to this problem:

  1. Modify the program by removing all screen interaction and screen logic
  2. Split the program into two separate programs, one containing the screen interaction and logic, and the other containing the service function

The first solution has a number of disadvantages:

  • It requires a massive modification of the code, which may result in errors
  • It results in duplication of code (supposing the original program is kept in production), hence requiring synchronized maintenance of the original and modified versions

The second solution, the one we recommend, avoids the pitfalls of the first. It uses a slicing technique, which could be achieved either manually or by the use of a specialized tool such as Relativity's Application Architect product.

Slicing could be described as follows. Given a program PROG with a paragraph PARA, two programs are created, PROG1 (main) and PROG2 (service), such that:

  1. PROG1 calls PROG2
  2. Paragraph PARA no longer exists in PROG1, but appears in PROG2
  3. PROG1 (which includes the call to PROG2) functions in a manner identical to the original PROG

Program slicing may be employed in order to separate the client functionality from the service functionality. In a simple case, suppose that a program communicates with a screen on which the user requests the content of an invoice with a particular invoice number. The program receives the screen, validates that the invoice number is correctly formatted, determines which program key was pressed by the user, invokes a paragraph GET-INVOICE to obtain the data, formats it, and displays it on the same screen. In this case, paragraph GET-INVOICE may be sliced out of the program. The resulting main program will now contain the screen logic, while the resulting service program will access the persistent storage and return the content of the invoice. Since this second program has the characteristics of a service, it could be exposed to the outside world as a Web service. Furthermore, the application will function just as it used to before the slicing.

If slicing is used to separate screen logic from service logic, the question is, which paragraph should be used as the basis for slicing?

Here, we face a situation similar to the one described earlier, wherein we must decide the level of the granularity offered by the service. If we aim too low in the paragraph call map, we risk obtaining services that are too granular and we are losing some of the business logic that prepares the data. If we aim too high, we risk including undesired screen logic. The best choice is to again select a frontier paragraph, which sits on the border of the screen and service logic. Such a paragraph would be the highest in the hierarchy of service type paragraphs.

In order to find the best slicing point, and to extract a slice that could be later used as a service, we proceed as follows:

  • Once we locate the program that requires slicing, we right-click on a node that represents it, and select the Show internal menu. As a result, we can see a new diagram that displays the relationships between paragraphs, as shown in the following figure:
    The Case of Mixed Programs — Program 'Slicing'
  • We must find the paragraphs which can be "sliced out" in the form of separate callable programs. We must select only paragraphs that:
    1. Do not access screens
    2. Do not call other paragraphs that access screens

    In the preceding figure, we can see that 000-ENTER-ORDERS cannot be sliced-out, as it calls 1400-SEND-ORDER-MAP, which contains screen operations. The same is true for other paragraphs, for instance, 2000-PROCESS-POST-ORDER or 1000-PROCESS-ORDER-MAP.

    There are other paragraphs that are good candidates for slicing. It is to our advantage to select one that is as high as possible in this call hierarchy, as that would provide maximum functionality. One such candidate is 1200-EDIT-ORDER-DATA, which accesses both the customer and the product files. Another one is 2100-WRITE-INVOICE-RECORD. If we create slices of these two paragraphs, we obtain two programs, which together offer the functionality needed to create an invoice.

  • To mark the selected paragraphs for slicing, we right-click on them and select the Create slice item menu. As a result, two things happen:
    1. The paragraphs are marked on the diagram indicating that we have selected them as candidates for slicing (as you can see in the figure)
    2. A list is created that contains information about these slicing points
      The Case of Mixed Programs — Program 'Slicing'
  • We switch now to the Application Architect in order to perform the actual slicing operation. We will find two slicing points in a list under the category, Architect. As we click on any item in this list, the Source pane will automatically select the corresponding paragraph for slicing, as shown in the following figure:
    The Case of Mixed Programs — Program 'Slicing'
  • We right-click Structure-Based in the Components pane, and then select the Define new menu, which opens up another pane, where the parameters of the slice are defined. We only have to point it to the paragraphs in the list created from SOA Analyzer to create a correct slicing definition, as shown in the following figure:
    The Case of Mixed Programs — Program 'Slicing'
  • We press the Extract button (represented by an icon showing scissors). We have to specify the number of parameters, say that we want the resulting program to be a CICS callable program. As a result, a new program is created, which contains the intended functionality, and could be exposed as a Web service.

Note

Keeping It Real: Slicing is a technique used by many application portfolio analysis tools. Slicing has been used for years to track back to the source of a problem in code, and was used heavily to help solve the Y2K. Slicing is useful in Legacy SOA Integration as it gives you the capability to look at the legacy artifacts embedded in an application as discrete components that can be exposed as services.

Determining the Data Interface

After we have found the right programs that can be exposed as Web services, we need to define their data interfaces. This is not a trivial task, for a number of reasons.

Let us take the case in which we want to expose the service that retrieves an invoice based on an invoice number. It would be great if:

  1. The definition of the COMMAREA of the service program could be stored in a copybook
  2. The COMMAREA could have a very simple definition, as in:
    01 COMMAREA.
    05 INVOICE-NUMBER PIC 9(7).
    05 INVOICE-CONTENT.
    10 INVOICE-DATE.....
    

In reality, we come across two problems:

  1. The definition of the COMMAREA may not reside in a copybook
  2. The COMMAREA defined in the LINKAGE section of the program may be very simple, as in:
    01 COMMAREA PIC X(30000)
    

thus, obscuring the actual fields that appear in another structure to which COMMAREA is moved in the program.

The SOA Analyzer will help us determine the correct interfaces and even create a complete WSDL definition for the service.

We will proceed as follows:

  • In SOA Analyzer, we select the Service | New menu, and give a name to the service. (We will call it Invoice.) This service will appear on a new pane of the tool.
  • Having selected this service, we select a proper program (which was found in the previous step), right-click on the node representing it and select the Add to Service menu. SOA Analyzer will analyze the program and detect its COMMAREA that will form the basis for the service interface. In the Service pane, the SOA Analyzer will display the following:
    Determining the Data Interface
  • In the Service pane, under the service called Invoice, we have a tree with a node called Seeds. Under this node, we find the specification for the program that we added to the service, including the COMMAREA that is used as in the interface. However, there is a common problem in that the COMMAREA appears as a single block of 90 bytes, which would not allow us to derive sensible and useful fields for the service interface.

    We solve this problem by designating a synonym for DFHCOMMAREA. A synonym is another data structure, which either redefines or is moved to DFHCOMMAREA, or DFHCOMMAREA is moved to that structure. Such synonyms are easy to find with the following procedure:

    • We select the DFHCOMMAREA in the Source screen and right-click on it
    • We select the Instances menu, which will show a list of all usages of this data structure and whether it is moved, or redefined
    • As we inspect the list, we select a convenient synonym
  • In this example, we notice that DFHCOMMAREA is moved to INVCTL-RECORD, which may supply a better definition of the interface. We select this data area in the Source pane, then select DFHCOMMAREA in the Service pane, and press the Import synonym menu. As a result, the definition of the interface in the Source pane changes to what we can see in the following figure:
    Determining the Data Interface
  • We now have a detailed specification for the COMMAREA. One last task that we should perform, before creating the WSDL, is to indicate the inputs and outputs of the interface. Although, all fields are both input and output by default, it would be nice to separate them if possible. In this case, it is quite easy, since one substructure contains INPUT and the other contains OUTPUT. We can right-click on INVCTL-INPUT and select the Make Input menu. In the same way, we select the INVCTL-OUTPUT and select the Make Output menu. As a result, the specification now looks as shown in the following figure, in which the arrows for the adjacent icons indicate the usage as either input, or output:
    Determining the Data Interface
  • We have come to the last step, that of creating a service definition. We right-click on the service and press the Generate WSDL menu. As a result, a WSDL definition for the service is generated and displayed as shown in the following figure:
    Determining the Data Interface
  • We can add more then one program to the service. In this case, each program will generate a service operation, while its COMMAREA will define an interface. The resulting WSDL can be exported to an outside file, by using the File | Export WSDL menu of the SOA Analyzer tool.

Note

Keeping It Real: In a perfect world, it would be nice to expose a COBOL COMMAREA (that is CICS transaction) area as a service easily. However, in the real world, the COMMAREA definition is not readily available, or it may contain unnecessary fields.

Summary Legacy Artifact Discovery Using Relativity

In the perfect world, you may be able to find the VSAM call to the invoice file that you wish to service enable easily. In reality, you will find that using tools like those offered from Relativity makes the task much easier, especially when faced with millions of lines of code that are poorly documented, or not well understood by your current staff. The last section showed you how to discover the data interface for the service to be exposed. In the next section, we will show how to expose this data access artifact, which we have just discovered.