Defining VSAM
//* DEFINE A VSAM KSDS
//DEFKSDS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
/* the trailing - is for continuation */
/* if delete fails there will be an error message which you can ignore */
DELETE (userid.VSAM.KSDS) CLUSTER
DEFINE CLUSTER -
NAME(userid.VSAM.KSDS) -
CYLINDERS(1,1) -
KEYS(10,0) /* length displacement */ -
RECORDSIZE(80,80) /* avg max */ -
INDEXED) /* ksds */
/*
Some options for defining VSAM
RECOVERY allow a restart of a load
SPEED opposite of recovery
UNIQUE the cluster will not be part of a dataspace containing other clusters
SUBALLOCATE opposite of unique
REPLICATE copy each index record on the track as many times as it will fit
NOREPLICATE opposite of unique
REUSE if there is data in the cluster, a repro or load will clobber the existing data
NOREUSE can do only one repro or load on this cluster
SHAREOPTIONS region system
region means roughly “this CICS” (an MVS can have more than one CICS running)
1 many jobs can read at same time
2 many jobs can read, only one can write
3 many jobs can read, many jobs can update, you’re on your own regarding data integrity
4 many jobs can read, many jobs can update
system means roughly “this MVS”
3 many jobs can read, many jobs can update, you’re on your own regarding data integrity
4 many jobs can read, many jobs can update
//* DEFINE A VSAM ESDS
//DEFESDS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE (userid.VSAM.ESDS) CLUSTER
DEFINE CLUSTER +
NAME(userid.VSAM.ESDS) -
CYLINDERS(1,1) -
RECORDSIZE(80,80) -
NONINDEXED)
//* DEFINE A VSAM RRDS
//DEFRRDS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE (userid.VSAM.RRDS) CLUSTER
DEFINE CLUSTER -
NAME(userid.VSAM.RRDS) -
CYLINDERS(1,1) -
RECORDSIZE(80,80) -
NUMBERED)
/*
//* LOAD A VSAM DATASET (KSDS, ESDS, RRDS) THEN PRINT IT
//LOADVSAM EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO INFILE(INDD) OUTDATASET(userid.VSAM.xxxx)
PRINT INDATASET(userid.VSAM.xxxx) CHARACTER
/*
//INDD DD * for KSDS, records must be in order
ELENA
LINDA
NADIA
SUSAN
/*