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 BatchAccountsOpenTest 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: The prefix of the CICS zOS data sets that contain load modules (SDFHLOAD) and source copybooks, macros, link SYSIN (SDFHC370, SDFHCOB, SDFHPL1, SDFHMAC, SDFHSAMP) that are used in program compile and link JCL.
Required: Yes, for CICS programs only. The property is not used in non CICS programs
Default value: 'CICS'
Valid values: A comma separated list of one or more valid zOS data set prefixes
Examples: zosprogram.cics.MVSA.dataset.prefix=CICS
zosprogram.cics.default.dataset.prefix=SYS1,CICS
zOS Language Environment data set prefix
Property: zOS Language Environment data set prefix
Name: zosprogram.le.[imageid].dataset.prefix
Description: The prefix of the Language Environment zOS data sets that contain load modules (SCEERUN, SCEERUN2) and source copybooks, macros, link SYSIN etc (SCEESAMP) that are used in program compile and link JCL.
Required: Yes
Default value: 'CEE'
Valid values: A comma separated list of one or more valid zOS data set prefixess
Examples: zosprogram.le.MVSA.dataset.prefix=CEE
zosprogram.le.dataset.prefix=SYS1.LE,CEE
zOS Program Language compile SYSLIBs
Property: zOS Program Language compile SYSLIBs
Name: zosprogram.[language].[imageid].compile.syslibs
Description: The site specific and language specific (COBOL, C, PL1, ASSEMBLER) custom zOS data sets that contain source copybooks and macros that are used in the compile SYSLIB concatenation in the zOS program compile and link JCL.
Required: No
Default value: None
Valid values: A comma separated list of one or more valid zOS data sets
Examples: zosprogram.cobol.MVSA.compile.syslibs=TEAM.COPYBOOK
zosprogram.cobol.compile.syslibs=COMPANY.COPYBOOK,TEAM.COPYBOOK
zOS Program Language data set prefix
Property: zOS Program Language data set prefix
Name: zosprogram.[language].[imageid].dataset.prefix
Description: The prefix of the language specific zOS data sets that contain STEPLIB load modules that are used in program compile and link JCL, for example, in COBOL - SIGYCOMP, in C - SCCNCMP, in PL1 - SIBMZCMP
Required: An entry is required for each language used, for example, COBOL, C, PL1, ASSEMBLER
Default value: None
Valid values: A comma separated list of one or more valid zOS data set prefixes
Examples: zosprogram.cobol.MVSA.dataset.prefix=IGY.V6R3M0
zosprogram.cobol.dataset.prefix=SYS1.COBOL,IGY.V6R3M0
zOS Program Language link SYSLIBs
Property: zOS Program Language link SYSLIBs
Name: zosprogram.[language].[imageid].link.syslibs
Description: The site specific and language specific (COBOL, C, PL1, ASSEMBLER) custom zOS data sets that contain load modules that are used in the link SYSLIB concatenation in the zOS program compile and link JCL.
Required: No
Default value: None
Valid values: A comma separated list of zOS data sets
Examples: zosprogram.cobol.MVSA.link.syslibs=TEAM.LOADLIB
zosprogram.cobol.link.syslibs=COMPANY.LOADLIB,TEAM.LOADLIB