Modern Mainframe
Published in

Modern Mainframe

How to Leverage Endevor Processors to Test Batch Applications

Editor: Vaughn Marshall

Agile and DevOps methodologies promise the ability to go faster while retaining quality. A key pillar supporting this is the use of automated testing in place of manual tests. There are a number of technologies, including Test4z, which provide test-centric APIs to allow tests to be written in any number of freely available modern testing frameworks. Another approach for the more Endevor-centric is to add automated tests leveraging Endevor processors as a first step or as a complement to the Open-first approach for Mainframe test automation provided by Test4z.

Automated Testing of Batch Applications in Endevor

Endevor has long been capable of automating the steps needed to move software changes from development into production. Given that, it should be no surprise that automated testing is a natural fit for Endevor-managed processes. Particularly close to Endevor are “batch” processes. Job Control Language (JCL) is the primary method for executing batch applications on the mainframe, and JCL is the language used for Endevor processors.

Using the sample Endevor processors and scripts located here, you can create a simple facility for tailoring and running automated tests of batch application changes.

How Does it Work?

State-of-the-art Endevor configurations leverage a simple language called “OPTIONS”, which specifies operating instructions to Endevor processors. OPTIONS may contain one or more statements in the following format:

An OPTIONS statement assigns a value to a variable. Modern and legacy developers alike recognize them. The syntax is supported in computer languages such as Java, C, Python, Rexx, JCL, and many more. Endevor’s OPTIONS variable names may use mixed case characters and be up to 250 characters in length. Variable names can be descriptive, making them easy to recognize and use. They are also recognized by Endevor processors that operate on them. Generally, Endevor’s OPTIONS are stored as an element type name such as OPTIONS, OPT, PARM, or some other user-preferred name.

These example OPTIONS statements support processing of COBOL elements in today’s modern Endevor processor:

The first statement provides instruction for a COBOL compile step, and the second statement instructs the Linker/Binder step in the Endevor processor.

How Can Options Initiate Automated Batch Tests?

By broadening the Endevor OPTIONS feature, instructions can be provided for invoking automated batch tests. Suppose that following a successful COBOL Generate or Move action, you want Endevor to initiate an automated batch test. The test might involve one or more of the JCL’s that execute your COBOL program. In this case, you could include additional AutomatedTest options statements such as these:

AutomatedTest is the prefix used for initiating automated batch tests. Within the variable name is also the name of an Endevor location, where testing is expected to occur. A location can be an Environment or Stage or other values— such as the target location for a Deploy to Test action. The examples indicate two automated tests are expected when the COBOL program reaches Endevor’s UTC stage. The second test is to be submitted only after the first one is completed. The value portions of the statements name a JCL element to be used for the automated test. If the JCL element has a different System or Subsystem than that of the COBOL element, you can specify them, as shown in the second example.

Element names for OPTIONS must match the element names of other types. An OPTIONS element for a COBOL program must have the same element name given to the COBOL program. Other element types may also have their own OPTIONS, including Assembler, PL/I, Easytrieve, Proc, Control Card, and JCL.

​A key element to testing batch applications in JCL is to tailor the JCL for the environment where the test is being run. If a JCL is being prepared in the DEV environment, then references to production resources such as input datasets, databases, and other objects, must be replaced with references to DEV resources. Additionally, it might be required that the job name and class values be modified to non-production job names and job classes. Once the preparations of the JCL are complete, the tailored JCL can be submitted. When the submitted job finishes, its outputs are captured, compared, and a determination is made to succeed or fail. All of these are actions taken by the Endevor processor of the Automated Test Facility.

How Are Inputs Tailored for Automated Tests?

OPTIONS statements control all aspects of automated testing. Consider an Endevor life cycle that includes UTC and QATURN stages. Statements like these for a JCL element instruct the processor to tailor the JCL for automated tests at the two stages, using paired search and replace instructions.

Delimiter characters, such as periods, underscores, “at signs”, and others may be used to separate words within the variable names. The result is that the OPTIONS read like simple English, and require very little introduction. The first three pairs apply only to the UTC stage in the examples above, and the last two apply only to the QATURN stage. The variable names also include action words — “FindTxt” and “Replace”. The numbered portion at the end of each variable name establishes the pairing. As you might expect, text within the JCL matching a given “FindTxt” value is replaced with the paired “Replace” value. The first pair changes the job name from ‘WALJO11P’ to ‘WALJO11T’ when testing in the UTC stage.

Not all preparations for testing can be made by applying search and replace text strings. A variation of the “REPLACEaction instructs the replacement of an entire DD specification, such as a STEPLIB. An “Insertxstatement allows text inserts to be strategically placed into the JCL — either before or after a “FindTxt” string. You can insert steps into your test job which execute FILE MASTER™ PLUS, for example, to prepare the data for the test. At or near the end of your test job, you can insert steps to conduct comparisons of the test results, contributing to the decision of whether the overall test was a success or failure.

Replaced and inserted JCL lines can be more than just pure text. Additional variables can be embedded within the text to provide even greater flexible substitutions. Variable names can be defined by the JCL processor to fetch values known by Endevor, including values defined on a Site Symbol table. The examples below show instructions for the DEV2 stage and demonstrate the use of common Endevor processor variables within the REPLACE values. Variables named C1STAGE, C1SYSTEM, and C1SUBSYS are replaced with values provided by Endevor.

How long will the processor wait for the job to run?

OPTIONS statements provide all detailed instructions. The Endevor processor loops a designated number of times, and at the end of each loop, determines whether the submitted job is completed. If the job is not completed, the processor waits in sleep mode for a period of time before checking again.

Options statements indicate the maximum number of loops and the length of the wait time between each loop. For example:

These statements indicate that the processor will loop up to 12 times. The processor will “sleep” for 2 seconds between each loop without using any computer resources. Each JCL can have its own values specified within its corresponding OPTIONS. If the submitted job fails or uses all of the designated WaitLoops, the processor marks the JCL element and the automated test as “FAILED”.

How Are Test Results Compared?

Dates, times, job numbers, and other text strings in the job outputs will likely never match. Therefore, additional OPTIONS statements allow for the “masking” of outputs to render a comparison that produces meaningful results. For example, output results for the submitted job might contain text that looks like this:

Before a comparison is made, “masking” instructions would modify the test results to look something like this.

Many “masking” instructions are built into the Automated Test Facility. However, if a JCL has its own unique outputs that need to be “masked” before the comparison, then the MoreMasks OPTIONS statement can be used.

For initial automated testing, and for cases where test result comparisons will never match, a MaxReturnCode OPTIONS statement can be used to indicate that compare differences are acceptable.

By default, the results of each test will be compared with the results of the previous test. However, with a Baseline statement, you can name the test results you want each test to be compared to.

What This Means for the Developer

Automated testing can be triggered by normal Endevor activity, from GENERATE actions and/or MOVE actions. Modern developers' methods to access Endevor, such as using Zowe commands or IDE plugins or integrations to Git, may also be used to manage the elements that control automated batch testing. You can even layer on added things like Static Application Analysis to find bugs without ever running the code by combining this Endevor automation with pipelines and external 3rd party tools.

While these are just a few examples, hopefully, you can see how Endevor provides the infrastructure to take the ‘manual’ out of testing and replace it with standard, repeatable processes that can improve your developer's velocity and keep their time focused on doing what they love most — writing code”.

See this site for Endevor-native batch testing using Endevor processors. You can press the “Autonomous Mode” button, and take the manual effort out of your testing, and automated application testing will be a new opportunity at your site.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store