Exercise 7
Create a test scenario that will setup JCL for the XAPGMBT1 with an input file and that will verify the produced output data set with an expected data set. The input file XATESTER.SIMU.XAPGMBT1.XAINPFIL should result in an output data set with content equal the expected data set XATESTER.SIMU.XAPGMBT1.XAOUTFI2
Step-by-step Instructions
Complete the following steps to create a test Scenario for XAPGMBT1:
- Locate the XAPGMBT1 program in the Repository view, right-click and select Create Total Test Scenario. Select simple and click Finish. This will create an empty test scenario with one Component execution.
- Create a Variable element by selecting the Variable from the palette and drag and drop it on top of the Component element. Name it input and enter the input data set name XATESTER.UDV.XAPGMBT1.XAINPFIL as a simple value.

- Create another Variable. Name it output and enter the expected output data set name XATESTER.UDV.XAPGMBT1.XAOUTFI2 as a simple value.

- Select the Component element in the editor and select the Setup JCL tab in the Element properties.
Write the below JCL in the Setup JCL input editor. Notice that we use the symbol ${input} to dynamically insert the input data set defined in the variable into the JCL at runtime.
//XAINPFIL DD DSN=${input},DISP=SHR
//XAOUTFIL DD DSN=XATESTER.UDV.XAPGMBT1.XAOUTFIL,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(15,5)),
// DCB=(LRECL=132,RECFM=FB,BLKSIZE=27984)
//XAERRFIL DD DSN=XATESTER.UDV.XAPGMBT1.XAERFIL2,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,(5,1),RLSE),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=32720,DSORG=PS)- Add a Read Dataset element after the component element. Write remote as ID and the path to XATESTER.UDV.XAPGMBT1.XAOUTFIL. This step is only used to show that we can extract a data set into the test scenario. An additional step with a Verify element could check the content of the file in the test case. Instead we will in the next step check the data set at the mainframe.

- Add a Verify Dataset element after the Read Dataset. Set the expected data set to be ${output} and the actual data set to be the produced XATESTER.UDV.XAPGMBT1.XAOUTFIL data set. This will compare the two data sets at the mainframe record by record, field by field. It is possible to setup exclude rules for which fields not to compare. This is not part of the exercise.

- Now we will check the content of the SYSOUT spool file in the XATEST step. First, insert a Read Spool File element and setup data as illustrated below.

- Add a Verify element and write an expression that the spool file contains the text Read XaInpFil ended with: 10.

Now the test Scenario is complete.
As an additional exercise, try to use DD name substitution instead of writing the complete JCL in the Component definition. In the repository, the JCL is defined for a default input/output data set. With DD name substitution this JCL is changed at runtime to use other data sets. Also add a data set comparison and see that a Verify Dataset appears underneath the Component element. The advantage with this embedded approach is that only one job is submitted instead of two.
