galasa

Close menu
Open menu

zOS Program Manager

ALPHA - This Manager is being actively developed. It is subject to change and has not been extensively tested.

Overview

This Manager allows Galasa tests to compile and link zOS Programs.

The @ZosProgram annotation defines the program to the Galasa test. Program attributes, for example, program name, programming language and source location are specified by using the annotation elements.

The source for the program is stored as a resource, along with the test. The z/OS Program Manager processes each @ZosProgram annotation before any of the test methods are executed. The Manager retrieves the source from the test bundle, builds and submits the relevant compile and link JCL based on the programs attributes and CPS properties. The batch job is saved with the test run archive. The program can be executed in the test by retrieving the library containing the load module by using the getLoadLibrary() method.

The Simbank tutorial BatchAccountsOpenTestBatchAccountsOpenTest contains an example of running a simulated z/OS program called SIMBANK by using the EXEC PGM=SIMBANK command.



You can view the Javadoc documentation for the Manager here.

Annotations

The following annotations are available with the zOS Program Manager

z/OS Program
Annotation: z/OS Program
Name: @ZosProgram
Description: The @ZosProgram annotation requests the z/OS Program Manager to Compile and Bind a program on a z/OS image. The test can request multiple z/OS Program instances
Attribute: name The program name
Attribute: location Path to the location of the program source in the Galasa test bundle. This can be either the full path including the file name or the directory containing the source with the name specified in the name attribute with the extension specified in the language attribute.
Attribute: language The programming language. See ZosProgram.Language.

Attribute: cics Is a CICS program and requires the CICS translator.
Attribute: loadlib The load module data set name
Attribute: imageTag The imageTag is used to identify the z/OS image.
Attribute: compile Compile this zOS program.
Syntax: @ZosImage(imageTag="A")
public IZosImage zosImageA;
@ZosProgram(imageTag="A")
public IZosProgram zosProgramA;
Notes: The IZosProgram interface has a number of methods to manage the zOS Program. See ZosProgram and IZosProgram to find out more.

Code snippets

Use the following code snippets to help you get started with the zOS Program Manager.

Compile and Link a COBOL program

The following snippet shows the code that is required to compile and link a COBOL program called MYPROG in a Galasa test:

@ZosProgram(name = "MYPROG",
        location = "source",
        language = Language.COBOL,
        imageTag = "A")
public IZosProgram myprog;

The program source is stored in a file named MYPROG.cbl in a folder named source in the test bundle resources folder. The manager builds the JCL to compile and link the source code and submits it on the zOS Image allocated in the zosImageA field.

Run the compiled program

The following snippet shows the code required to run the compiled program in a batch job:

@ZosImage(imageTag = "A")
public IZosImage image;

@ZosBatch(imageTag = "A")
public IZosBatch zosBatch;

...

StringBuilder jcl = new StringBuilder();
jcl.append("//STEP1   EXEC PGM=");
jcl.append(myprog.getName());
jcl.append("\n");
jcl.append("//STEPLIB DD DSN=");
jcl.append(myprog.getLoadlib().getName());
jcl.append(",DISP=SHR\n");
jcl.append("//SYSOUT  DD SYSOUT=*");
IZosBatchJob job = zosBatch.submitJob(jcl.toString(), null);
...

The manager created a load library for MYPROG because the @ZosProgram annotation did not specify one. The name of the library is obtained using the getLoadlib() method on the field so that it can be added to the STEPLIB in the JCL.

Configuration Properties

The following are properties used to configure the zOS Program Manager.

zOS CICS data set Prefix
Property: zOS CICS data set Prefix
Name: zosprogram.cics.[imageid].dataset.prefix
Description: zOS CICS data set prefix
Required: Yes
Default value: None
Valid values: $validValues
Examples: zosprogram.cics.MVSA.dataset.prefix=CICS
zosprogram.cics.default.dataset.prefix=SYS1,CICS
zOS LanguageExtended Environment data set prefix
Property: zOS LanguageExtended Environment data set prefix
Name: zosprogram.le.[imageid].dataset.prefix
Description: zOS LanguageExtended Environment data set prefix
Required: Yes
Default value: None
Valid values: $validValues
Examples: zosprogram.le.MVSA.dataset.prefix=CEE
zosprogram.le.dataset.prefix=SYS1.LE,CEE
zOS Program LanguageExtended specific custom compile syslibs
Property: zOS Program LanguageExtended specific custom compile syslibs
Name: zosprogram.[language].[imageid].compile.syslibs
Description: zOS Program LanguageExtended data set prefix
Required: No
Default value: None
Valid values: $validValues
Examples: zosprogram.cobol.MVSA.compile.syslibs=TEAM.COPYBOOK
zosprogram.cobol.compile.syslibs=COMPANY.COPYBOOK,TEAM.COPYBOOK
zOS Program LanguageExtended data set prefix
Property: zOS Program LanguageExtended data set prefix
Name: zosprogram.[language].[imageid].dataset.prefix
Description: zOS Program LanguageExtended data set High Level Qualifier
Required: Yes
Default value: None
Valid values: $validValues
Examples: zosprogram.cobol.MVSA.dataset.prefix=IGY.V6R3M0
zosprogram.cobol.dataset.prefix=SYS1.COBIL,IGY.V6R3M0
zOS Program LanguageExtended specific custom link syslibs
Property: zOS Program LanguageExtended specific custom link syslibs
Name: zosprogram.[language].[imageid].link.syslibs
Description: zOS Program LanguageExtended data set prefix
Required: No
Default value: None
Valid values: $validValues
Examples: zosprogram.cobol.MVSA.link.syslibs=TEAM.LOADLIB
zosprogram.cobol.link.syslibs=COMPANY.LOADLIB,TEAM.LOADLIB