Training Objects: Creating Test Data for Jazz Tutorials

Creating Test Data for Jazz Tutorials. 1

Introduction. 1

Create Sequential File IN1. 1

Generating the file – z/OS.. 2

Generating the file – Micro Focus Enterprise Developer 2

Print file IN1 (Optional) 7

Create VSAM File FR.. 8

Create VSAM Cluster 8

Create Test Data. 10

Print FR (Optional) 12

Create CICS FCT Entries (Optional) 12

Creating CustF. 12

Create CustF Cluster 14

Load CustF. 16

Create the AIX and Path. 18

Create FCT Entries for CICS.. 18

Testing programs CICS1 and CICS2. 18

Creating Parts and Orders. 21

Parts. 22

Orders. 22

Introduction

Jazz videos and Users’ Guide tutorials use various files to demonstrate Jazz features.  The files are very small, only 300 Customers, 10 Regions, only a few Parts and Orders: enough to demonstrate a variety of situations like look up a record, look up a record that isn’t there, handle page overflow etc, but not enough to demonstrate large-scale processing or do stress testing.  They are designed to help you with Jazz training, where a small (and quick) tests are better than processing production-scale data sets that typically just repeat the same demonstration thousands of times.

Training objects, shipped with Jazz and downloaded when you click [Add Training] from the Configuration form, create these files. This Users’ Guide section tells you how to use these objects to create the files.   You can download these items selectively as you need them, or simply select and download them all.  To download the training objects,

1.    Open the Jazz Workbench and click [Configure]

2.    Click [Add Training].  This opens a Windows Explorer showing the objects available for download

3.    Select the items you want to download.  To select all, select the first, and then with Shift pressed select the last.

4.    Click [Open].  In this context this means “Select” and the selected objects are downloaded into the appropriate Jazz folders.

You don’t need to do every step of this section in order: for example, if you don’t want file FR you can skip that section.  However, to create file CUSTF you must have created file IN1.  Such dependencies are noted.

Create Sequential File IN1

File IN1 is used in some examples: it is a basic sequential file containing 300 records.   Program IN1W.jzz, one of the objects available within the folder of Training Objects, will create this file for you.  Open program IN1W, click [Check]:-

Message #378 warns us that we may have to change the JCL.  If z/OS is our test system, then this is done before the job is fully processed.  With MFED (Micro Focus Enterprise Developer) we change the JCL within the Micro Focus COBOL project.

Generating the file – z/OS

Right-click [Process] and then click [JCL].  Jazz runs the first three steps: [Check], [COBOL], and [JCL], but then stops with the Process form displayed and the button [Find JCL] changed to [Review JCL].  Click [Review JCL] and change the //IN1   DD   statement from

//IN1      DD DSNAME=JAZZUSER.FILES.IN1,DISP=SHR

to

//IN1      DD DSNAME=JAZZUSER.FILES.IN1,DISP=(NEW,CATLG),

//            SPACE=(TRK,(1,1))

Save the edited IN1W.JCL, then click [Submit] to submit the compile and go job.  You are returned to the Jazz Workbench. When the job has run [Job Results] turns green.  Click this to see the job output.

Generating the file – Micro Focus Enterprise Developer

Click [Process].  Jazz generates COBOL and JCL, and the project button ([CWSProject] in this example) turns green.  Click this to open the MFED COBOL project in Visual Studio.  Look at the Solution Explorer window.  Although we have just generated COBOL into the \cbl folder, there’s no sign of it, nor of the JCL. 

They need to be added to the project.  Right-click the project, and choose Add/Existing item. A FileOpen dialog appears.  Open the .cbl subfolder.  You will see a number of .cbl files that are not in the project: -

Select IN1W and all the JZxxxx routines.  JZxxxx routines are general-use routines: for example, JZDT01 formats a date on a printed report, JZDTAR is used if your program contains DATE arithmetic.  It can be difficult for you to know when they are used, it’s easiest to just include them all in your project.

To add the JCL, again right-click the project and choose Add/Existing item.  This time navigate to the Jazz_LocalJCL folder, and select IN1W.JCL.

In Visual Studio/Solution explorer, our project now looks like this when we expand cbl and Jazz_LocalJCL: -

Double-click IN1W.JCL to open it, and edit it as described above for z/OS: change the //IN1   DD   statement from

//IN1      DD DSNAME=JAZZUSER.FILES.IN1,DISP=SHR

to

//IN1      DD DSNAME=JAZZUSER.FILES.IN1,DISP=(NEW,CATLG),

//            SPACE=(TRK,(1,1))

Save this. 

Right-click the project and click Build. 

If your project has been defined like TSTSQL with SQL enabled you may get error messages like this: -

for program IN1 and the JZ modules.  This is because we haven’t yet completed SQL setup, and the SQL switch routines aren’t yet available.  None of these modules require SQL, so you can get rid of these messages by setting the properties of the individual COBOL programs: -

·         Right-click the object, say IN1W.CBL, click Properties

·         Click the SQL tab.  Check [P] Set explicitly no SQL.

You may get errors because the project contains objects have been created with COBOL dialect Micro Focus, but the Jazz objects expect COBOL dialect IBM Enterprise COBOL.  The supplied training programs include code like this which is invalid with other COBOL dialects.

000350 FILE-CONTROL.                                                    IN1W

000360     SELECT IN1  ASSIGN TO IN1                                    IN1W

000370                 FILE STATUS IS IN1-STATUS.                       IN1W

000380     SELECT RepNbr1  ASSIGN TO RepNbr1                            IN1W

000390                     FILE STATUS IS RepNbr1-STATUS.               IN1W

Change the project’s COBOL dialect to IBM Enterprise COBOL and rebuild.  Now the errors disappear from IN1W.cbl, but there may now be errors with previous programs.  For example, in project LoanDemo there are errors with book.cbl.

Right-click book1.cbl, click Properties.  Set the COBOL dialect for this to Micro Focus.   Rebuild.  Now the project builds cleanly.

We could have done this the other way around, leaving the project’s COBOL dialect as Micro Focus and changing IN1W to use IBM Enterprise COBOL.  I have chosen to change the project default because there will be more Jazz programs added to it.

If you have previously run batch programs from this project then you can now run program IN1W by

·         Right-click IN1W.jcl, click Submit JCL

However if this is the first time that you have attempted to run batch programs the output will show messages like this: -

Submit JCL file starts ...

Submit JCL file to TSTSQL completed

CASBJ0050E JES support not enabled; Job rejected 10:08:07

Processed "C:\tutorials\TstSQL\Jazz_LocalJCL\IN1W.JCL"

To enable JES: -

·         Open ESMAC (right-click Micro Focus Servers in Visual Studio/Server Explorer, click Administration)

·         Click [Edit] corresponding to the server

·         Navigate to Server/Properties/MSS/JES, and check Job Entry Subsystem enabled: -

 

·         Click [Apply].   Close ESMAC, return to Visual Studio

·         Server Explorer: restart server LoanDemo

·         Solution Explorer, right-click IN1W.JCL.  The Job is submitted and run, and the Output window shows

·         Clicking the link shows the job output
 

·         Program IN1W writes a report to file REPNBR1.  Click this link to see the 300 records written to the file

Print file IN1 (Optional)

If you want to independently print the file you’ve just created, there is a program IN1R.jzz downloaded with the training objects.  If you want to do this, open Jazz program IN1R and [Process] it. 

With z/OS, when the [Job Results] button turns green click it to see the job output.  With Micro Focus this button will have a project name [MFJazz1] in the snap above.  Click this to open the MF Cobol Project, add IN1R.CBL and IN1R.JCL to it, build the solution, then submit the JCL.  Results will look something like this: -

Create VSAM File FR

This is similar, using programs FRW to write the file and FRR to read it, but a difference is that FR is a VSAM file so a VSAM cluster is needed.  

Create VSAM Cluster

The record FR has already been defined to Jazz (FR.jzc is one of the items downloaded when you clicked [Add Training]): -

DEFINE FR VSAM DATA(

    Region PIC '999' KEY RANGE (1:20),

    Name CHAR(30) VALUE('No Record found') HEADING 'Region Name',

    Fill CHAR(47))

    DSNAME 'JAZZUSER.VSAM.Region';

This makes creating a VSAM cluster for it easy.  From the Jazz Workbench, click [JazzGen] and Select /Data/VSAM to open the VSAM form: -

For z/OS users the middle button will be labelled [Submit].  For Micro Focus users it will be labelled with the name of the associated MF COBOL Project.

Click [Browse] and browse to the definition fr.jzc.  It’s in the \Jazz_CopyDefs subfolder of your project folder

Check [  ] Cluster

Set the number of 1ry records you expect to have in the file.  FR is very small, 10 will do.

Click [JCL]

z/OS users: with Test Environment = z/OS the button will change to [Review] and the [Submit] button will be activated.  You can review the job and edit it if you wish.  Click [Submit] to submit the job to z/OS.  The VSAM form closes and you’re returned to the Jazz Workbench.  When the [Results] button turns green you can view the job output.

Micro Focus users: with Test Environment = IDE, the VSAM form closes and you’re returned to the Jazz workbench.  The [project] button will be highlighted.

·         Click this to open the COBOL project.  As usual the newly-created object, FR.jcl, is in not in the project.

·         Right-click the project in Solution Explorer, and click Add/Existing item. Browse to FR.JCL, and click [Add].

·         Solution Explorer: Right-click FR.JCL, click Submit JCL

·         Click the link from the output page to review the job output.

·         Click SYSPRINT to confirm that the cluster has been defined

Create Test Data

Open program FRW.  Click Process]: -

z/OS users: when [Job Results] turns green, click it to see the job output.

Micro Focus Users:  The project button, [CWSProject] in this example, turns green immediately.  Click this to [re]open the MF COBOL Project

With Add/Existing Item add FRW.CBL and FRW.JCL to the project: -

Build the project, then submit FRW.JCL.

If there are problems you may need to restart the Micro Focus server LoanDemo

Print FR (Optional)

Repeat this process with program FRR to print the file: -

Click [Process], then open project LoanDemo (CWSProject).

In project LoanDemo, add (Add/Existing Item) FRR.CBL and FRR.JCL

Build the project, and submit the JCL.  Here is the report printed in the job output, showing that we’ve created the test data as expected: -

Create CICS FCT Entries (Optional)

Creating CustF

In the Classical CICS tutorials and in the Web Services tutorials, the earlier example programs require a VSAM file Custf, while the later programs also require a related file called ORDERS.  Both are VSAM files, but unlike FR they both have alternate indexes.  This makes the VSAM definition a three step process. 

First the VSAM function is used to define the cluster. 

Then a program (CustFW, OrdersW) is run to load data into them. 

Finally, after they have been loaded a second VSAM function is used to create the alternate indexes.

Before CustF can be loaded we create sequential file IN1.  Although this is not used in the CICS programs, the program Custfw.jzz that writes data into Custf is based on logic to copy IN1 to Custf, so it is needed in step Load Custf. 

Start Jazz, click [Configure] to display the Jazz Configuration form, and then click [Add Training] to select and add training objects to your Jazz libraries.  Select Custf*, IN1*, and Order* objects, and TestData.jzc: -

Close [Configure] to return to the Jazz workbench.  Repeat the process described in JazzUGMFStep2 Create IN1, but within project ACCT, to create the sequential file IN1: -

1.            Process Jazz Program IN1W.jzz,  creating objects IN1W.cbl and IN1.jcl in the relevant folders

2.            Click [ACCT] to open the ACCT project, and add objects IN1W.cbl and IN1W.jcl objects to it.

3.            Edit IN1W.jcl (as suggested by message #378), changing the //IN1   DD   statement from

//IN1      DD DSNAME=JAZZUSER.FILES.IN1,DISP=SHR

to

//IN1      DD DSNAME=JAZZUSER.FILES.IN1,DISP=(NEW,CATLG),

//            SPACE=(TRK,(1,1))

If you’re repeating this step, use DISP=(OLD,CATLG),

4.            Save the edited IN1W.JCL, Build the solution, and then submit IN1W.jcl.

Create CustF Cluster

Here is the definition of CustF (from the Jazz Copy Books folder, included from Jazz with training objects).  Note that as well as the primary key Account there is a duplicate key on Name.  This will require an alternate index to be created.  However VSAM doesn’t allow us to create an alternate index until we’ve initialised the cluster by writing some data into it.

First, we define a VSAM cluster as we did for FR. 

·         From the Jazz Workbench click [JazzGen] and select Data/VSAM.  

·         Browse to the \Jazz_CopyDefs\Custf.jzc, and check Cluster. 

·         Set 1ry to 300, and click [JCL]: -

Jazz will have created this JCL to create the VSAM cluster: -

//JAZZUSER JOB ,CLASS=A,MSGCLASS=A

//JZVSAM2   EXEC PGM=IDCAMS   Manage VSAM Data Sets

//SYSPRINT DD SYSOUT=*

//SYSIN    DD *

 DEFINE CLUSTER (NAME (JAZZUSER.VSAM.CUSTF) -

     RECORDS(300 30) -

     RECORDSIZE(53 53) KEYS(6 0) INDEXED)

/*

z/OS users: click [Submit].  The form disappears and the Jazz Workbench re-appears.  When the [Results] button turns green click this to review that that job has correctly created the cluster.

Micro Focus users: when [JCL] is clicked this form disappears and the Jazz Workbench appears with the project button highlighted. 

·         Open the MF Project.  Import the item CUSTF.JCL using Add/Existing Item: -

·         Now submit this JCL.  The VSAM cluster is created, but the alternate index and path still don’t exist.

·         Click the output link to the job results and review the job output to check that the cluster has been created.

·         Restart MF Server LoanDemo.  I’m not sure if this is necessary, but it has become my practice to restart the server after VSAM Create Cluster etc to avoid locking the cluster and so preventing following operations on the data set.

Load CustF

Program CustfW, which is included in the Training objects, will create an initial 300 records.

Open program CustFW: -

This copies file IN1, using the Process index as ACCOUNT value.  As usual, click [Process] and then [ACCT] (which will have gone green), and add CustfW.cbl and CustFW.jcl to the COBOL project.   But the JCL needs to be edited before we can run it: -

Jazz has generated JCL to access CUSTF including a DD for the alternate index, but the alternate index doesn’t exist yet.  Remove the line //CUSTF1 DD …

and save CusftW.JCL.

With this change made, build solution ACCT and submit CustfW.JCL.  The output shows the 300 created records.

Create the AIX and Path

Now return to Jazz, invoke the VSAM function (Jazz Workbench: [JazzGen] Data/VSAM), this time checking the AIX checkbox. 

Click [JCL] to create it, and then the [ACCT] button on from the Jazz workbench.  CUSTF.JCL will now create the alternate index and path: -

With Micro Focus you don’t need the BLDINDEX command so you can remove it if you like.  However it will be ignored with a harmless message if you don’t.  Submit this JCL

Create FCT Entries for CICS

Since CustF is to be used with classical CICS and CICS web services we need to define FCT entries to make CustF and its alternate index known to CICS.

Testing programs CICS1 and CICS2

As with program Menu1, we need to add PCT entries to group MANAJAZZ for transactions TRN1 => CICS1 and TRN2 => CICS2, and PPT entries for CICS1, CICS1S, CICS2, and CICS2S.   But there is also a new feature: VSAM file Custf. We have to make Custf available to CICS before we can run programs CICS1 and CICS2.

Open ESMAC, and navigate to group MANAJAZZ.   Add PCT entries for transactions TRN1 => CICS1 and TRN2 => CICS2, and PPT entries for CICS1, CICS1S, CICS2, and CICS2S.  

Click [FCT].  Fill in the Name (in capitals, e.g. CUSTF, not Custf), Description, and File Path, ensure that Read, Add, Browse, Delete, and Update are all checked.   Check Start Open.  Check Use Catalog

Click here for more information about this FCT Page.

Create another FCT, with the same options, for the alternate index, Custf1: -

Click [Add].  Click [Install].   Here is the MANAJAZZ group after this has been done: -

Stop server ESACCT.   Build solution.  Start server ESACCT, right-click it, click Mainframe TN3270 Display.

 

Creating Parts and Orders

Program CICS3 and some of the later Web Service objects use a simplified Customers – Orders – Parts data model, like this.   We have already created the customer file, CustF, but we need to create the Parts and Orders files: -

Note: currently (July 2018) these files haven’t been created within project LoanDemo.  The notes below are illustrated using project ACCT, which was used for classical CICS.

Parts

Parts.jzc looks like this: -

DEFINE Parts VSAM DATA(

    Partnbr SMALLINT KEY,

    PartName CHAR(30) VALUE 'Part Name Absent' DKEY 'Jazzuser.vsam.parts1',

    StandardPrice DECIMAL(7,2))

    DSNAME 'Jazzuser.vsam.Parts';

1.    First create a cluster, using [JazzGen] => Data => VSAM to create appropriate JCL.  Add this JCL to project ACCT, and submit it

2.    Now compile program PartsW.jzz to COBOL, and add Partsw.cbl and Partsw.jcl to project ACCT.  

3.    Edit Partsw.jcl to remove the unwanted //Parts1 DD …

4.    Build the ACCT solution, and then submit Partsw.jcl

5.    Use [JazzGen] => Data => VSAM to create JCL, this time clicking the AIX checkbox. 

6.    In project ACCT edit the JCL to remove the BLDINDEX command, which is not needed with Micro Focus.  Then submit the JCL

We have now created a small parts file, with parts numbered 1 to 10: -

Of course a real parts file would have many more records, and many more fields in each record, but this test data is sufficient for the demonstration.

Orders

Orders.jzc looks like this. 

COPY Custf;

COPY Parts ;

DEFINE Orders VSAM DATA(

    OrdNbr DECIMAL(5) DPIC '99999' KEY HEADING 'Order Number',

    OrdCustId LIKE CustF.Account DKEY 'jazzuser.vsam.Orders1' EXISTS CustF.Account ,

    ordDate DATE,

    OrdPart LIKE Parts.Partnbr DKEY 'jazzuser.vsam.Orders2' EXISTS Parts.Partnbr,

    OrdQty SMALLINT,

    OrdDiscount DECIMAL (3,1) HEADING 'Order Discount',

    OrdStatus CHAR(1) CODES(I:Initial, C:Confirmed,Q:'Part Shipped', S:Shipped, B:Billed, P:Paid))

    DSNAME 'jazzuser.vsam.Orders';

 

Note that it has TWO alternate indexes, one on OrdCustID so that we can look up orders by customer, and one on OrdPart so that we can look up orders by Part Nbr. Both of these are defined LIKE xxx EXISTS xxx, making it easy for us in writing the definition as it ensures that the corresponding fields in both files have the same format, and ensuring that values in Orders must be primary key values in the respective files.   With SQL organization this relationship would be checked when we write an Orders record, but with VSAM it is not checked unless we use an ACCEPT statement. 

Create VSAM file Orders following the same steps as for Parts, with the minor difference that there are two alternate indexes: -

1.    First create a cluster, using [JazzGen] => Data => VSAM to create appropriate JCL.  Add this JCL to project ACCT, and submit it

2.    Now compile program OrdersW.jzz to COBOL, and add OrdersW.cbl and OrdersW.jcl to project ACCT.  

3.    Edit OrdersW.jcl to remove the unwanted // Orders1 DD … and // Orders2 DD … and

4.    Build the ACCT solution, and then submit OrdersW.jcl

5.    Use [JazzGen] => Data => VSAM to create JCL, this time clicking the AIX checkbox. 

6.    In project ACCT edit the JCL to remove the BLDINDEX commands, which are not needed with Micro Focus.  Then submit the JCL