Setup instructions

Before you use the Enterprise COBOL AZUTC003 sample, allocate data sets for the source file and generated files, copy the sample file into a partitioned data set, create a property group that specifies compiler and link options for the data sets, and create a z/OS® project for the sample.

Before you begin

Connect to the remote system and allocate data sets for the sample by using the instructions in Sample JCL to allocate ZUnit data sets.

About this task

The Enterprise COBOL AZUTC003 sample is in the rdz\AZUTC003\src folder of the installation path, for example, C:\Program Files\IBM\SDP\rdz\AZUTC003\src. The sample includes the following files:
File name Description
ANAGRA2.cbl A sample COBOL program that compares two strings and determines whether they are anagrams. This program has an error on line 99 that is detected by the test case:
             TO WORD-BUF-2(1:FIRST-WORD-LEN)
      * The above phrase is not valid, the following is valid phrase
      *       TO WORD-BUF-2(1:SECOND-WORD-LEN)
The commented line 101 shows the correction.
ANAGRAM.cpy A COBOL copybook that contains the input and output interface for program ANAGRA2.
AZUTC003.cbl An Enterprise COBOL ZUnit test case that was generated from the ANAGRA2.cbl sample program. This test case program is statically linked with ANAGRA2.cbl, which is the program to be tested. AZUTC003.cbl contains three separate tests to validate whether ANAGRA2.cbl detects valid anagrams. In AZUTC003.cbl, test ENTRY3 exposes a bug or limitation in ANAGRA2.cbl. When you work through the sample scenario, you generate your own copy of this program. This sample is provided to help you compare your results to the expected results.
AZUTC003.azucfg A ZUnit test runner configuration file that defines the test cases to be run and the test runner options. When you work through the sample scenario, you generate your own copy of this file. This sample is provided to help you compare your results to the expected results.
AZUTC003.azures A ZUnit test runner results file that contains sample test results. When you work through the sample scenario, you generate your own copy of this file. This sample is provided to help you compare your results to the expected results.
SORTCHAR.cbl A stub program that was generated by the Create/modify Test Case wizard for the SORTCHAR subroutine of ANAGRA2.cbl. When you work through the sample scenario, you generate your own copy of this program. This sample is provided to help you compare your results to the expected results.
When you work through the sample scenario, you generate additional files that are used to demonstrate ZUnit functions.

Procedure

To set up the Enterprise COBOL AZUTC003 sample:

  1. Copy the ANAGRA2.cbl sample file into the <HLQ>.COBOL.SOURCE.COBOL data set.
  2. Copy the ANAGRAM.cpy sample file into the <HLQ>.COBOL.COPYLIB data set.
  3. In the Property Group Manager, select the remote system that contains the ZUnit data sets and create a property group that specifies the following categories and properties.
    Category > Page Property Value
    Info Name AZUPG001
      Description Property group for the ZUnit samples
    JCL JCL job card Specify any JCL statements required for the z/OS system. You might need to add a JCLLIB statement to call ELAXF* remote build procedures. For more information, see ELAXF* remote build procedures.
    Link > Procedures and Steps Link options DYNAM(DLL) NOREUS
      Link libraries CEE.SCEELKED <HLQ>.LOAD
      Use specified link instructions Select this check box and specify:
    INCLUDE AZUTSTRX
      Load module location <HLQ>.LOAD
      Additional JCL
    //******* ADDITIONAL JCL FOR LINK HERE ******
    //LINK.SYSDEFSD DD DUMMY
    //LINK.AZUTSTRX DD DISP=SHR,
    // DSN=&FELPRFX..SFELSAMP(AZUTSTRX)
    Link > JCL substitution User variables: Variable name FELPRFX
      User variables: Variable value: Specify the data set prefix for the *.*.SFELSAMP partitioned data set. Contact your systems administrator for the data set name.
    COBOL > Procedures and Steps Compiler options SOURCE LIB
      Debug data set <HLQ>.COBOL.SYSDEBUG
      Object deck data set <HLQ>.ZUNIT.COBOL.OBJECT
      SYSLIB <HLQ>.COBOL.COPYLIB
      Support Error Feedback Select this check box and specify this data set qualifier for compiler errors: <HLQ>.ERRCOB
  4. In the z/OS Projects view, create a z/OS project named ZUnit Samples z/OS Project and an MVS™ subproject named AZUTC003, associate the AZUPGCOB property group with the subproject, and add the data sets that you allocated to the subproject.
    Tip: By using the New z/OS Project wizard, you can complete all of these actions at the same time. The wizard guides you through the process of creating the project, creating the subproject, associating the property group with the subproject, and adding remote resources to the subproject. To start the wizard, select New > z/OS Project from the pop-up menu of the z/OS Projects view.
  5. In Preferences > z/OS Automated Unit Testing Framework (ZUnit), select Test runner (AZUTSTRN). Click Apply and then close the setting.

Results

The following resources are added to your workspace:
Figure 1. Property group. Property group editor with a property group created for the Enterprise COBOL test data samples.
Property group editor with a property group created for the Enterprise COBOL ZUnit test data samples.
Figure 2. z/OS Projects view. z/OS Projects view with Enterprise COBOL AZUTC003 sample data sets loaded.
z/OS Projects view with Enterprise COBOL ZUnit test data sample data sets loaded.

What to do next

Create/modify a test case from ANAGRA2.cbl