Friday, December 18, 2009

A Maven plugin to upload sources on z/OS

LegStar is a mix of Java code and z/OS native code written in C370 and COBOL.
The LegStar build system makes extensive use of Maven, a widely used build automation tool. Maven drives the LegStar release process by pulling source code from SCM, compiling, testing and generating documentation.
All the legStar z/OS native source code is managed locally using Subversion. What was missing so far was the capability to upload and compile these sources on z/OS as part of the Maven build lifecycle.
After several attempts at using the ant FTP task, I decided to write my own Maven plugin. Following the tradition of open sourcing everything in LegStar, you can find the zosupload project on google hosting.
It is quite rudimentary at this stage but it has the minimal capability to upload sources in various PDS libraries, submitting JCL for execution and checking condition codes returned as part of a Maven build.
I expect others will have the same mix of local Java and native z/OS code they would like to keep in sync so I am hoping they will contribute to that project.

Monday, December 7, 2009

COBOL-aware middleware

Two phenomenons with opposing effects have affected COBOL structures over time.
The first one is a tendency to construct complex data structures with many fields. This would allow to store a maximum amount of information in a VSAM record or database segment for instance. This was an important factor in reducing physical I/O and getting the best performances possible. When data structures were passed from program to program, they also tended to be large structures because developers would typically try to reduce the number of programs and hence, would rather write big programs that handle many cases than many smaller programs.
When the mainframe opened up to program to program communication over networks though, these large structures became a problem because networks were slow. So the next tendency was to try to find ways to reduce the size of the data sent over the network even if the structures stayed complex and large.
The most widely used mechanism to reduce the size of the data is the variable size array (an array with the DEPENDING ON clause). This is a awkward type of array for people used to java and C. It is an array which actual size is given by a variable, appearing somewhere in the structure (before the array itself).
The second mechanism is not related to COBOL per-se but more with the middleware used. Because structures contain many fields, it often happens that these fields contain default values. For instance, alphanumeric fields might contain binary zeros, which is usually interpreted as "no content". If the middleware is smart enough, it can avoid sending these non initialized fields over the network thus saving a lot of bandwidth.
Variable size arrays also need to be handled correctly by middleware. For instance sending the maximum number of items would be wasteful. A more tricky situation arises when the middelware invokes a mainframe program that returns a variable size array. Often, the memory needed by the target program to operate must be allocated beforehand by the middleware. But how can the middleware anticipate the number of rows that the program will return?
As you can see there are good reasons why middleware used to communicate with mainframe programs need to be COBOL-aware.