Setting VSAM file entry for COBOL

In the Test Case Editor window, you can set file organization and record key for a COBOL VSAM file.

Before you begin

For information about known limitations in the Test Case Editor, see COBOL Limitations.

The Test Case Editor opens in table format with rows that represent parameters in a data record and columns that represent test entries.

About this task

The Test Case Editor displays data records for a COBOL source program and any subroutines or dependent files that are discovered when the source program is parsed by the ZUnit parser, which is based on the COBOL importer. The data records are displayed in table format.

For a VSAM file, in the PIC column, VSAM displays for a VSAM file, and File Organization (SEQUENTIAL, INDEXED, and RELATIVE) displays in the USAGE column when the source program is opened in the Test Case Editor. Specify the VSAM file organization in the File Organization column. Refer to the following Test Case Editor window for more information.

The following VSAM file types are supported:
  • Entry sequential data set (ESDS)
  • Relative record data set (RRDS)
  • Key sequenced data set (KSDS)

To open the Test Case Editor, select a source program in the Remote Systems or z/OS Projects view, and then click z/OS Automated Unit Testing Framework (ZUnit) > Create/modify Test Case. ZUnit analyzes the source program file, generates a test case, and opens the test case in the Test Case Editor.

You can generate stub programs simulate the VSAM file. If Use test data is selected in the Set File Test Type dialog box, the STUB program is generated.

You can use an existing file to conduct the unit test of the VSAM file I/O. By specifying various attributes you can choose to use the user-allocated VSAM file instead of the automatically generated VSAM file.

Procedure

  1. On the File I/O page of the z/OS Automated Unit Testing Framework (ZUnit) wizard, under the Working file section, clear the selection of Allocate data set for working file automatically.
  2. Prepare the VSAM file. You can choose any way to prepare the VSAM file from multiple methods.
    • Operate on the Developer for z/OS® workbench.
      1. Right click on MVS Files in Remote Systems view. Select New > Allocate VSAM Data Set.
      2. Specify data set name and attributes on the Allocate VSAM Data Set wizard.
      3. Click Finish.
    • Insert the customized DEFINE CLUSTER statements into the JCL to run ZUnit test case.
      1. In Property Group, select ZUnit > Procedures and Steps.
      2. Select procedure AZUZUNIT under the Procedure and step table. Click the Add Step button.
      3. Name the new step and add the step in the Procedure and step table.
      4. Select the new step. Click the Up button to move the new step before the RUNNER procedure.
      5. Click the Edit button to open the step under Runner Step Options.
      6. Add DEFINE CLUSTER statements into Additional JCL of the new step.
        Note: You need to specify the REUSE option to the DEFINE CLUSTER statements.
  3. Insert DD statements to use the user-allocated VSAM file into the JCL to run ZUnit Test Case.
    1. In Property Group, select ZUnit > Procesures and Steps.
    2. Select procedure AZUZUNIT under the Procedure and step table. Double click RUNNER. The Additional JCL view opens.
    3. Enter DD statements to use the VSAM file.
    Note: When you select the existing file that has different file organization in the Set File Test Type dialog box and click OK, a message informs you to select the correct file associated with the file organization and Set File Test Type will be canceled.
    • For KSDS files, you need to enter the Test Data with specifying record key in Test Case Editor. Random order is acceptable.

      When a KSDS file is selected and one or more data of record key name, key length, record key offset is different from the attributes of the selected file, you will receive an error message and Set File Test Type will be canceled.

    • For RRDS files, relative key does not display in Test Case Editor. You need to input each record sequentially.

    You can select Undo and Redo in Test Case Editor.