IBM MTM 2018: Part Two – Challenge #09

Why am I doing the challenges so slow? I heard they update the leaderboards every Friday. I want to have finished part 2 all of its challenges by next Friday the 12th of October.  So expect a load of blog posts by then! Don’t worry about all the notification mails though, I’ll merge some challenges into one blogpost.

Data, Data Sets, and Unix files

IBM Master the Mainframe Part Two – Challenge #09

In this episode of Kevin’s Coding Blog you’ll learn a thing or two about VSAM and NON-VSAM data sets.
NON-VSAM includes
1) Sequential
2) PDS, Partitioned Data Set
3) PDS/E, Partitioned Data Set/Extended
VSAM includes
1) KSDS, Key Sequences Data Set
2) ESDS, Entry Sequenced Data Set
3) RRDS, Relative Record Data Set
4) LDS, Linear Data Set
We use parameters inside the JCL to let the system know which data set to make. This is also the assignment for today. I need to replace all @-characters with the appropriate parameters to create the correct data sets.
  • &SYSUID..CH9.SEQ created as a sequential data set type
  • &SYSUID..CH9.PDS created as a partitioned data set type
  • &SYSUID..CH9.PDSE created as a partitioned data set extended type
  • &SYSUID..CH9.KSDS created as a VSAM Key Sequenced Data Set type
  • &SYSUID..CH9.ESDS created as a VSAM Entry Sequenced Data Set type
  • &SYSUID..CH9.RRDS created as a VSAM Relative Record Data Set type
  • &SYSUID..CH9.LDS created as a VSAM Linear Data Set type

In particular all of the data sets above. &SYSUID. is automatically replaced by my ID, Z30163.

Now what do I need and where can I learn which parameters I need to pass? IBM provided the links beneath.

VSAM Tutorial 
VSAM Tutorial - Defining a Cluster 
DSORG 
DSNTYPE

But anyway, let’s take a look at CH09JCL its code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//CH09JCL JOB 1,NOTIFY=&SYSUID
//* --------------------------
//DELETE EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *,SYMBOLS=CNVTSYS
DELETE &SYSUID..CH9.SEQ
DELETE &SYSUID..CH9.PDS
DELETE &SYSUID..CH9.PDSE
DELETE &SYSUID..CH9.KSDS
DELETE &SYSUID..CH9.ESDS
DELETE &SYSUID..CH9.RRDS
DELETE &SYSUID..CH9.LDS
SET MAXCC=0
//* --------------------------
//NONVSAM EXEC PGM=IEFBR14
//SEQ DD DSN=&SYSUID..CH9.SEQ,DISP=(NEW,CATLG),
// SPACE=(TRK,(1,1)),UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,DSORG=@@)
//PDS DD DSN=&SYSUID..CH9.PDS,DISP=(NEW,CATLG),
// SPACE=(TRK,(1,1,1)),UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,DSORG=@@)
//PDSE DD DSN=&SYSUID..CH9.PDSE,DISP=(NEW,CATLG),
// SPACE=(TRK,(1,1,1)),UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,DSORG=@@),DSNTYPE=@@@@@@@
//* --------------------------
//VSAM EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *,SYMBOLS=CNVTSYS
DEFINE CLUSTER(NAME(&SYSUID..CH9.KSDS) -
VOLUME(VPWRKC) TRACKS(1,1) -
@@@@@@@ -
KEYS(1 79) -
RECORDSIZE(80 80) -
CONTROLINTERVALSIZE(4096)) -
DATA(NAME(&SYSUID..CH9.KSDS.DATA)) -
INDEX(NAME(&SYSUID..CH9.KSDS.INDEX))
DEFINE CLUSTER(NAME(&SYSUID..CH9.ESDS) -
VOLUME(VPWRKC) TRACKS(1,1) -
@@@@@@@@@@ -
RECORDSIZE(80 80) -
CONTROLINTERVALSIZE(4096))
DEFINE CLUSTER(NAME(&SYSUID..CH9.RRDS) -
VOLUME(VPWRKC) TRACKS(1,1) -
@@@@@@@@ -
RECORDSIZE(80 80) -
CONTROLINTERVALSIZE(4096))
DEFINE CLUSTER(NAME(&SYSUID..CH9.LDS) -
VOLUME(VPWRKC) TRACKS(1,1) -
@@@@@@)

//* --------------------------
// IF RC = 0 THEN
//* --------------------------
//RESULT EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
LISTDS CH9.SEQ
LISTDS CH9.PDS
LISTDS CH9.PDSE
LISTC ENT(CH9.KSDS) ALL
LISTC ENT(CH9.ESDS) ALL
LISTC ENT(CH9.RRDS) ALL
LISTC ENT(CH9.LDS) ALL
//* --------------------------
// ENDIF

There are three EXEC statements. At first it deletes any existing CH9 related data set. Then the second statement creates NONVSAM data sets. The last statement creates VSAM data sets. There’s also a last EXEC statement that executes only when RC equals to 0.

The first three should be simple, I just need to assign the correct DSORG. The first needs to be a sequential data set type which is PSPS stands for physical sequential. The other two require a DSORG and PDSE also requires a DSNTYPE.

So I need to create a PDS and PDSE data set. Creating the PDSE requires the DSORG=PO and DSNTYPE=LIBRARY. The SMS will choose whether it will be a PDS or PDSE. I guess it’ll pick PDSE because I added the DSNTYPE. To create a PDS data set we leave out the DSNTYPE.

1
2
3
4
5
6
7
8
9
10
//NONVSAM EXEC PGM=IEFBR14
//SEQ DD DSN=&SYSUID..CH9.SEQ,DISP=(NEW,CATLG),
// SPACE=(TRK,(1,1)),UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,DSORG=PS)
//PDS DD DSN=&SYSUID..CH9.PDS,DISP=(NEW,CATLG),
// SPACE=(TRK,(1,1,1)),UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,DSORG=PO)
//PDSE DD DSN=&SYSUID..CH9.PDSE,DISP=(NEW,CATLG),
// SPACE=(TRK,(1,1,1)),UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,DSORG=PO),DSNTYPE=LIBRARY

Observe the changes I made in the code above. That was fairly easy, VSAM on the other hand… oof. Let’s first create the key-sequenced data set (KSDS). The tutorialspoint KSDS tutorial states that we must code INDEXED inside the DEFINE CLUSTER and it seems that hasn’t been done yet. Add that and check! Same but different for the ESDS data set, we must code NONINDEXED inside the DEFINE CLUSTER.

What’s the deal with INDEXED and NONINDEXED? Well, ESDS is non-index and KSDS is. This means that there are no index component keys present inside an ESDS data set. Which means that an ESDS data set may contain duplicate keys. More info at tutorialspoint.com.

Regarding RRDS, we must also code NUMBERED inside the DEFINE CLUSTER command. Easy! Then LDS needs LINEAR. I wasn’t all too sure about the LINEAR statement but after some research here, I found out that LINEAR is used to specify that this CLUSTER needs to be of type LINEAR. Let’s take a look at the result!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//VSAM EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *,SYMBOLS=CNVTSYS
DEFINE CLUSTER(NAME(&SYSUID..CH9.KSDS) -
VOLUME(VPWRKC) TRACKS(1,1) -
INDEXED -
KEYS(1 79) -
RECORDSIZE(80 80) -
CONTROLINTERVALSIZE(4096)) -
DATA(NAME(&SYSUID..CH9.KSDS.DATA)) -
INDEX(NAME(&SYSUID..CH9.KSDS.INDEX))
DEFINE CLUSTER(NAME(&SYSUID..CH9.ESDS) -
VOLUME(VPWRKC) TRACKS(1,1) -
NONINDEXED -
RECORDSIZE(80 80) -
CONTROLINTERVALSIZE(4096))
DEFINE CLUSTER(NAME(&SYSUID..CH9.RRDS) -
VOLUME(VPWRKC) TRACKS(1,1) -
NUMBERED -
RECORDSIZE(80 80) -
CONTROLINTERVALSIZE(4096))
DEFINE CLUSTER(NAME(&SYSUID..CH9.LDS) -
VOLUME(VPWRKC) TRACKS(1,1) -
LINEAR)

This should be it! Let’s submit the job!

Don’t forget, use the ? sign to ask information about the job. I’ve printed the output to P2.OUTPUT. Let’s check if I created the data sets…

Yes I did! This challenge probably would’ve taken me about 5-10 minutes if I wasn’t writing this blog whilst doing the challenge.

The screenshot above is the copied output inside P2.OUTPUT(#09). No errors or anything! I’m a happy man!

6 + 15 = 21

Jup, that’s right! That’s the amount of challenges left. I’ve completed about 10 if you include the first part. I know, 10 isn’t all too much. But each challenge also has a very fun blogpost so… Anyway, counting how much you have left to do is always a bad practice. Either you get motivated or you get demotivated. It’s ok in this case though! I’m fine!

What about you? What’s been keeping you motivated?

9 thoughts on “IBM MTM 2018: Part Two – Challenge #09

  1. hi kevin…very interesting and educational vlog

    i submitted job and i checked using ‘?’ but i did not get the result ..
    can u help me?

    1. Hi Homer!

      Did you enter the question mark next to the JOB in the status display after you’ve submitted it? Just like we did in challenge 05 https://kevindurant.be/wp-content/uploads/2018/09/p2-c5-7.png. In case you did that, then I guess you didn’t correctly edit all parameters. Try using the primary command ‘find @’ to see if anything is highlighted.

      Are there any error logs presented to you? Does the return code look normal after you submit te job (e.g. MAXX or RC)? To jump back to the job status display use the primary command ‘=sd ; st’.

      – Kevin

Leave a Reply

Your email address will not be published. Name, email and website not required.