JCL

LISTCAT use in retrieving GDG or VSAM Information

The LISTCAT command is used to list and view the attributes and characteristics like space allocation information, password and security-related information, usage characteristics, creation, and expiration date, etc of VSAM or non-VSAM entries. It stands for LISTing of CATalog entry. The LISTCAT line command allows access to IDCAMS and displays the tablespace or indexspace space usage information as a report. The LISTCAT command can execute if:

  • The actual space name appears on the report line. In this case, the command executes against the requested object.
  • A table name and creator are displayed. In this case, the command executes on the table’s tablespace.
  • An index name and creator are displayed. In this case, the command executes on the index’s indexspace.

LISTCAT is useful when you want to determine how much space you are currently using and how much space is available for extending the data set.

LISTCAT is more than just a dataset lookup command. It gives you a clear picture of how a dataset is defined in the catalog and how much space it uses. For VSAM administrators and mainframe developers, it is a fast way to confirm file properties before running jobs that depend on those datasets.

It is also useful in automation, because LISTCAT returns a completion code that can be used in conditional processing. For example, if a GDG base or VSAM cluster is missing, you can use the return code to branch to another step.

SYNTAX:
LISTCAT                                  -
  [ENTRIES(entry-name1 [entry-name2…])]  -
  [object-type]                          -
  [optional-paramter]

ENTRIES (ENT) requires you to specify each level of qualification, either explicitly or implicitly, using an asterisk as a wild card character.

entry-name specifies the file name for which we want to view details. You can list and view multiple file entries with single LISTCAT command.

object-type can be ALIAS, ALTERNATEINDEX, CLUSTER, GENERATIONDATAGROUP, INDEX, LIBRARYENTRY, NONVSAM, PAGESPACE, PATH, USERCATALOG, VOLUMERNTRY

LISTCAT common output levels

Option What it shows
NAME Entry name and type.
HISTORY Ownership, creation date, expiration date, and status.
VOLUME HISTORY plus volume serial and device type.
ALLOCATION VOLUME plus detailed space allocation.
ALL Full catalog information, including attributes and statistics.

Example:  

//STEP0100 EXEC PGM=IKJEFT01     
 //SYSTSPRT DD DSN=&&L,         
 //            DISP=(,PASS),              
 //            SPACE=(CYL,(1,1),RLSE),        
 //            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)  
 //SYSTSIN  DD *              
   LISTCAT ENT('NJUST.NJUSIUS1.NJGCL404.X.TABREC') ALL
 //*  

Result: The following example illustrates the results of the LISTCAT line command.

    LISTCAT ENTRIES('NJUST.NJUSIUS1.NJGCL404.X.TABREC') HISTORY 
  0GDG BASE ------ NJUST.NJUSIUS1.NJGCL404.X.TABREC              
        IN-CAT --- CATALOG.PRJT01                                
        HISTORY                                                  
          DATASET-OWNER----NB5564A     CREATION--------2010.081  
          RELEASE----------------2     LAST ALTER------0000.000  
  0   NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0001V00      
        IN-CAT --- CATALOG.PRJT01                                
        HISTORY                                                  
          DATASET-OWNER-----(NULL)     CREATION--------2010.081  
          RELEASE----------------2     EXPIRATION------0000.000  
  0   NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0002V00      
        IN-CAT --- CATALOG.PRJT01                                
        HISTORY                                                  
          DATASET-OWNER-----(NULL)     CREATION--------2010.085 
          RELEASE----------------2     EXPIRATION------0000.000  
  0   NONVSAM ---- NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0003V00      
        IN-CAT --- CATALOG.PRJT01                                
        HISTORY                                                  
          DATASET-OWNER-----(NULL)     CREATION--------2010.085  
          RELEASE----------------2     EXPIRATION------0000.000  
 …………………..
 …………………………

 LISTCAT
 ENT(DA0001T.VSAM.KSDS.CLUSTER) -
 CLUSTER -
 ALL  

 LISTCAT
 ENT(DA0001T.VSAM.KSDS.CLUSTER) -
 DATA -
 ALL

 LISTCAT
 ENT(DA0001T.VSAM.KSDS.CLUSTER) -
 ALL

How to extract the latest version & creation date of a GDG from LISTCAT result.

//STEP02 EXEC PGM=SORT        
//SYSOUT   DD SYSOUT=*                
//SORTIN   DD DSN=&&L,DISP=(OLD,PASS)         
//SORTOUT  DD SYSOUT=*    
//SYSIN    DD *     
INCLUDE COND=(04,7,CH,EQ,C'NONVSAM',OR, 
37,8,CH,EQ,C’CREATION’,OR, 
01,8,CH,EQ,C’GDG BASE',OR,
01,7,CH,EQ,C'NONVSAM',OR, )           
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:17,44),
BEGIN=(1,8,CH,EQ,C'GDG BASE’,OR,4,7,CH,EQ,C’NONVSAM’,
OR,01,7,CH,EQ,C'NONVSAM'))    
SORT FIELDS=(53,4,ZD,D,57,3,ZD,D)  
OUTFIL INCLUDE=(37,8,CH,EQ,C’CREATION’),  
BUILD=(81,44,125,4,DT1,EDIT=(TTTT-TT-TT),26C’ ‘),
ENDREC=1       
//*

Result: 

NJUST.NJUSIUS1.NJGCL404.X.TABREC.G0003V00           2010-03-26        

How to extract total number of records from an input file using SORT.

//STEP0300 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                    
//SORTIN   DD DSN=&&L,DISP=(OLD,PASS)                      
//SORTOUT  DD SYSOUT=*    
//SYSIN    DD *    
SORT FIELDS=COPY  
OUTFIL FILES=OUT,TRAILER1=(1:COUNT),REMOVECC,NODETAIL
//*
                              

Result: 98765

Include Omit Condition: Click Here SYNCSORT Manual: Click Here

Admin

Share
Published by
Admin

Recent Posts

AI Product Owner : Use Cases with Examples and Tools

The Product Owner role has shifted from just being a requirements proxy to a strategic,…

9 months ago

Business Value: Crafting User Stories for Measurable Impact

Business Value: In the world of Agile development, the user story has long been the…

10 months ago

SAFe Scrum Master (SSM) Certification with FAQ and Tips

The SAFe Scrum Master certification has become one of the most sought-after credentials for Agile…

1 year ago

PSK Practice Exam Practice Mode Questions

The Professional Scrum with Kanban (PSK) course enhances your organization's ability to deliver value efficiently…

1 year ago

Effective User Interviews in Scrum Framework

Effective User interviews play a crucial role in Scrum methodology, helping Product Owners and Scrum…

1 year ago

User Research Tools and Techniques for Product Owners

Product Owners should be well-versed in various user research tools and techniques to effectively understand…

1 year ago