You are on page 1of 3

MF WORKBENCH VSAM USER GUIDE

Invoking VSAM through Jcl.

Step 1 : Create a member in a JCL PDS and write the following code to
create a vsam cluster (KSDS).

//JOBNAME JOB
//DEFKSDS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE CLUSTER -
(NAME(EMPLOYEE.KSDS.CLUSTER) -
VOLUMES(VSAM02) -
CYLINDERS(2,1) -
CONTROLINTERVALSIZE(4096) -
FREESPACE(10,20) -
KEYS(9,0) -
RECORDSIZE(50,50)) -
DATA -
(NAME(EMPLOYEE.KSDS.DATA)) -
INDEX -
(NAME(EMPLOYEE.KSDS.INDEX) -
CONTROLINTERVALSIZE(1024) -
CATALOG(VSAM.USERCAT.TWO))
/*
//

1
STEP 2 : save the file and submit the job by typing ‘sub’ at the
command line as an ordinary job.If the computers
encounters any errors it will give the error message in the job
log otherwise the message ‘job ended normally ‘ is
displayed on the screen. It means that a vsam cluster is
created.

STEP 3 : You can enter data into this cluster through your application
program or load data from a sequential data set using the
“REPRO” command. To load data write the
following jcl in a pds and submit it.

//JOBNAME JOB
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO -
INDATASET(EMP.DAT)
OUTDATASET(EMPLOYEE.KSDS.CLUSTER)
/*
//

STEP 4 : We can View the data through the application program ( as


if you are accessing an ordinary dataset)

STEP 5 : To Create An Alternate Index You Need To Write The


Following JCL

2
//JOBNAME JOB
//DEFAIX1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE AIX -
(NAME EMPLOYEE.KSDS.AX1.CLUSTER) -
RELATE (EMPLOYEE.KSDS.CLUSTER) -
VOLUMES(VOL1) -
CISZ(2048) -
KEYS(2,35) -
UNIQUEKEY -
UPGRADE -
RECORDSIZE(16,16) -
FREESPACE(20,20) -
SHAREOPTION(2,3) -
DATA -
(NAME(EMPLOYEE.KSDS.AIX1.DATA))
INDEX -
(NAME(EMPLOYEE.KSDS.AIX1.INDEX))
/*
//

Note : Record length of unique key alternate index = 5 + length of


alt key + length of prime key.