With the introduction of some new Language Environment (LE) z/VSE callable services, the ability for a COBOL program to allow seamless execution from within either the batch or CICS environments became a reality.
This article demonstrates how to implement some of the new LE z/VSE callable services in a COBOL/VSE program. This will provide the application programmer with the ability to develop COBOL/VSE applications that can be executed seamlessly within either batch or CICS environments. Allowing batch or CICS applications to reuse COBOL/VSE routines will improve time-to-ship and reduce development time. COBOL/VSE routines can be developed so they can be called and used by other more environment-specific routines to perform a common process; for example, as company-specific date/time formatting or extraction, integral file or database access, etc.
Applicable Callable Services Review
First, let’s review the callable services that will provide the functionality to allow a COBOL program to interrogate its environment and make execution directives based upon this information:
- CEE5INF, introduced with z/VSE 4.1 as part of LE z/VSE 1.4.5, provides the caller with specific execution environment information such as the operating system and where the current execution is occurring. For information and samples for the CEE5INF service, see the LE z/VSE Programming Reference Guide available with z/VSE 4.1 or above.
- CEESITST, introduced with VSE/ESA 2.5 and LE/VSE 1.4.1, along with a number of other similarly functioning services, allows the caller to test individual bits of a provided field and return the result. For languages such as COBOL, where bit manipulation and interrogation at best are difficult, this and the associated services provide some common and simple callable services that can return results of field interrogation or manipulation at the bit level. For more information on CEESITST and associated complementary services, see the latest available LE z/VSE Programming Reference Guide.
Callable Service Implementation
Using the environment information provided by the CEE5INF service, and then calling the CEESITST bit testing service with the information returned from CEE5INF, we can establish in which environment our COBOL/VSE program is executing. By setting a corresponding 88-level flag, we can create an execution logic flow based on specific processing for the batch or CICS environments. Figure 1 shows how to do this using COBOL/VSE.
Case Study Definitions and Code
Assume the fields in Figure 1 are already defined in the Working-Storage and Linkage sections.
The 0300-check-env paragraph section code would look similar to Figure 2. This section is used to determine the COBOL program’s current execution environment.