LDS (for Beginners)
Summary
For basic information, go through the LDS (for Experienced)
- LDS is a short form of Linear DataSet and is a byte-stream dataset in traditional z/OS files.
- LDS is used mainly by DB2, z/OS system but is rarely used in application programs.
- Data from LDS is accessed as byte-addressable strings in virtual storage.
- LDS has no control information in its CI. i.e., no RDFs and CIDFs.
- Logical records are not visible from the VSAM point of view. i.e., LDS is a non-VSAM dataset with some VSAM facilities.
- LDS contains a DATA component only.
DEFINE LDS Syntax -
IDCAMS DEFINE CLUSTER command with LINEAR is used to create the LDS dataset.
Syntax - JCL for creating LDS dataset with minimum parameters
//JOBCARD
//*------------------------------------------------------------------
//* Definition of LDS
//*------------------------------------------------------------------
//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE CLUSTER (NAME(userid.CLUSTER.NAME) –
CYLINDERS(primary secondary) –
VOL(XXXXXX) –
BUFFERSPACE(buffer-space) –
CISZ(ci-size) –
FREESPACE(primary secondary) –
LINEAR –
NOREUSE –
OWNER(userid) ) –
DATA (NAME(userid.CLUSTER.NAME.DATA)) –
CATALOG(XXXXXX)
/*
Refer IDCAMS DEFINE command for full set of parameters.
Create LDS Example -
Requirement - Create LDS using the IDCAMS utility.
Code -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEGJL JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//************************************************************
//* DEFINE VSAM LDS CLUSTER
//************************************************************
//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
DEFINE CLUSTER(NAME(MATEGJ.TEST.LDS) -
CYLINDERS(2,1) -
CISZ(4096) -
VOLUMES(DEVHD4) -
LINEAR -
REUSE ) -
DATA(NAME(MATEGJ.TEST.LDS.DATA))
/*
**************************** Bottom of Data ****************************
In the above JCL, MATEGJ is the userid and change them all as required.
Output -
Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, LDS is successfully created.
![Create LDS Output](img/create-lds-output0.png)
Verify the LDS in 3.4 (Dataset List utility) or any File management tools.
![Create LDS Output](img/create-lds-output.png)
Explaining Example -
In the above example,
- CYLINDERS(2,1) specifies the primary memory allocation is 2 CYLINDERS, and secondary memory allocation is 1 CYLINDER.
- VOLUMES(DEVHD4) specifies that allocate the LDS on volume DEVHD4.
- LINEAR parameter specifies the file is to create LDS.
- REUSE specifies that the memory can reuse immediately once the file gets deleted.
Delete LDS Example -
Requirement - Delete LDS using the IDCAMS utility.
Code -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEGJD JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//************************************************************
//* DELETING LDS
//************************************************************
//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE 'MATEGJ.TEST.LDS'
/*
**************************** Bottom of Data ****************************
In the above JCL, MATEGJ.TEST.LDS is the LDS name that is planned to delete.
Output -
Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, LDS successfully got deleted.
![DELETE LDS Output](img/delete-lds-output0.png)
If required, verify the LDS in 3.4 (Dataset List utility) or any File management tools to double-check.
![DELETE LDS Output](img/delete-lds-output.png)
Explaining Example -
In the above example, the MATEGJ.TEST.LDS (LDS file) successfully deleted and uncatalogued(space released).