LDS (for Experienced)


Summary
  • 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 a control interval (CI) size multiple of 4096 bytes.
  • LDS has no control information in its CI. i.e., no RDFs and CIDFs.
  • LDS is the VSAM dataset type used by DIV (Data-In-Virtual) facility.
  • Logical records should be blocked and deblocked by the application program to avoid concurrent updates.
  • Logical records are not visible from the VSAM point of view. i.e., LDS is a non-VSAM dataset with some VSAM facilities.
  • Unlike the ESDS and RRDS, LDS contains a DATA component only.
  • LDS is mainly used by IBM DB2.

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 changes 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

Verify the LDS in 3.4 (Dataset List utility) or any File management tools.

Create LDS Output

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

If required, verify the LDS in 3.4 (Dataset List utility) or any File management tools to double-check.

DELETE LDS Output

Explaining Example -

In the above example, the MATEGJ.TEST.LDS (LDS file) successfully deleted and uncatalogued(space released).

Note! If the file is already deleted and trying to delete the file again, we may receive MAXCC as 08. So, verify the file once before proceeding for delete.