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.
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
Optional parameter of LISTCAT
Parameter | Description |
---|---|
NAME | HISTORY | VOLUME | ALLOCATION | ALL | This parameter is used to specify the fields to be included for each entry listed. When specified NAME, lists the name and type of the entries. When specified HISTORY, lists the following information for each entry:- name, type of the entry, owner-id, creation date, expiration date, release, status (if entry is GDG or non-VSAM),. When specified VOLUME, lists all the information provided by specifying HISTORY, plus it also lists the volume serial numbers and device types allocated to the entries. When specified ALLOCATION, lists all the information provided by specifying VOLUME, plus it also lists the detailed information about the space allocation. When specified ALL, lists all the information specified in the above options plus some other information such as CA-RECLAIM, and fields under 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’ ‘), a  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