DEFV (Define VSAM Statements)

Purpose
This function produces IDCAMS define statements for one or more VSAM data sets to an output data set defined to DD FMNDEFV.
Figure 1. Syntax

1 DEFV
2? DSNLIST=(+ ,dsn1,dsn2,...dsnN)

Where,

DSNLIST
Is a list of comma delimited data set names. A fully qualified or generic data set name can be specified. Only VSAM clusters matching the data set names specified are included in the DEFINE statements produced.

In a generic name, use the percent (%) sign to represent a single character, and an asterisk (*) to represent any number of characters within one qualifier. Two asterisks (**) represent any number of characters within any number of qualifiers.

Example 1. Batch job
//FMBAT EXEC PGM=FMNMAIN                
//FMNDEFV DD SYSOUT=*                  
//SYSPRINT DD SYSOUT=*                  
//SYSIN DD *                            
$$FILEM DEFV ,                          
$$FILEM DSNLIST=(FMN.FMDATA.K*,         
$$FILEM FMN.FMDATA.ESDS,                
$$FILEM userid.FMDATA.**)              
Example 2. REXX exec for usage with ISPF 3.4
/* REXX - VSAM define statements for data set  */         
ARG DSN                                                   
CALL FMNELIBD DEF       /* Remove if not using LIBDEFS */ 
ADDRESS TSO                                               
  "ALLOC FI(FMNPRINT) DA(*) REUSE"                        
  "ALLOC FI(FMNDEFV) NEW SP(1,5) TRACKS"                  
ADDRESS ISPEXEC                                           
  "SELECT CMD(FILEMGR $DEFV DSNLIST=("DSN")"              
  "LMINIT DATAID(DEFID) DDNAME(FMNDEFV) ENQ(SHR)"         
  IF RC = 0 THEN DO;                                      
    "VIEW DATAID("DEFID")"                                
    IF RC > 8 THEN                                        
      "SETMSG MSG("ZERRMSG")"                             
    "LMFREE DATAID("DEFID")"                              
  END;                                                    
ADDRESS TSO                                               
  "FREE FI(FMNPRINT)"                                     
  "FREE FI(FMNDEFV)"                                      
CALL FMNELIBD DROP      /* Remove if not using LIBDEFS */ 
EXIT 0;