[USflag] The American Programmer [USflag]


Home
Books on Mainframe Programming
Mainframe Manuals and Tutorials
System Abend codes, Sqlcodes, VSAM/QSAM codes
Everything about the IBM AS/400 Midrange Computer
Everything about CICS
Everything about COBOL
Everything about DB2 and SQL
Everything about IMS
Everything about Java and JavaScript
Everything about JCL and JES
  Just Enough JCL. A bare-bones introduction
  Examples of JCL
  Examples of Idcams JCL
  Examples of JCL to run SYNCSORT
  Example of JCL to run ISPF in batch
  Example of JCL to run SQL in batch
  Example of JCL to run REXX in batch
  Books on JCL
  JCL Manuals
Everything about REXX
Everything about zOS, VSAM, Tivoli, Assembler
Everything about TSO, ISPF, Spufi
Site Map and Site Search

           Home   > JCL   > IDCAMS Examples

IDCAMS program examples

Examples of some of the things that you can do with IDCAMS (Access Method Services)
//IDCAMS1  EXEC PGM=IDCAMS                            
//SYSPRINT DD SYSOUT=*                                
//VSFILE   DD DSN=VSAM.FILE,DISP=SHR                  
//FILE1    DD DSN=userid.ANYFILE.DATA,DISP=SHR        
//INFILE   DD *                                       
R1                                                    
R2                                                    
R3                                                    
//OUTFILE  DD SYSOUT=*                                
//SYSIN    DD *                                       
 /* GET INFO */                                       
 LISTCAT ENT(userid.MY.TEST.FILE) VOLUMES             
                                                      
 /* THIS WILL ACCESS DATASET  */                      
 PRINT IDS(userid.MY.TEST.FILE) COUNT(1)              
 PRINT INFILE(FILE1) COUNT(1)                                      
                                                                   
 /* DEFINE A GENERATION DATA GROUP (APOST NOT NEEDED */            
 DEFINE GDG (NAME('userid.TEST.GDG') LIMIT(4) SCRATCH NOEMPTY)     
                                                                   
 /* CHANGE THE LIMIT ON A GENERATION DATA GROUP */                 
 ALTER            'userid.TEST.GDG' LIMIT(3)                       
                                                                   
 /* DELETE A GENERATION DATA GROUP IF IT IS EMPTY*/                
 DELETE           'userid.TEST.GDG' GDG                            
                                                                   
                                                                   
 /* CREATE AN EMPTY DATASET AND CONNECT IT TO DDNAME NEWOUT */     
 ALLOC DSN('userid.TEST.FILE') NEW REUSE SPACE(1,1) TRACKS -       
 LRECL(80) RECFM(F,B) DDN(NEWOUT)                                  
                                                                   
                                                                   
 /* RENAME A DATASET */                                            
 ALTER       'userid.TEST.FILE' NEWNAME('userid.TEST2.FILE')       
                                                                   
                                                           
 /* DO SOMETHING BASED ON A RETURN CODE FROM COMMAND */    
 ALLOC DSN('userid.TEST.FILE') SHR REUSE DDN(XXYYZZ)       
 IF MAXCC EQ 0 THEN  DO                                    
    SET MAXCC = 7                                          
    CANCEL  /* SETS MAXCC = 12 */                          
    END                                                    
    ELSE DO                                                
    END                                                    
                                                           
                                                           
 /* COPY */                                                
 REPRO INFILE(INFILE) OUTFILE(NEWOUT) SKIP(1) COUNT(2)     
                                                           
 /* ANOTHER WAY TO COPY */                                 
 REPRO INFILE(INFILE) OUTDATASET('userid.TEST.FILE)'       
                                                           
 /* DELETE */                                              
 DELETE 'userid.TEST.FILE'                                 
                                                           
                                                         
 /* CHECK IF A VSAM FILE WAS CLOSED CORRECTLY */         
  VERIFY FILE(VSFILE)                                    
  VERIFY DATASET(XYZ.DATA)                               
/*                                                       

[Books Computer]

Home Books for Computer Professionals Privacy Terms |
Site Map and Site Search Programming Manuals and Tutorials The REXX Files Top of Page |