ALTER command.


ALTER command
·        The ALTER command can be used to change most of the attributes that are specified at the time a VSAM object is DEFINEd.  

·        Syntax
ALTER  entryname[/password]
    [ADDVOLUMES(volser[ volser...])]
    [BUFFERSPACE(size)]
    [EMPTY  |  NOEMPTY]
    [ERASE  |  NOERASE]
    [FREESPACE(CI-percent[ CA-percent])]
    [KEYS(length offset)]
    [NEWNAME(newname)]
    [RECORDSIZE(average maximum)]
    [REMOVEVOLUMES(volser[ volser...])]
    [SCRATCH  |  NOSCRATCH]

    [TO(date)  |  FOR(days)]
    [UPGRADE  |  NOUPGRADE]

    [CATALOG(catname[/password])] 

·        For most of the options meaning is same  as that of the specified in the DEFINE statement.

·        KEYS AND/OR RECORDSIZE PARAMETER SPECIFIED FOR NON-EMPTY OBJECT.

The below code does not work as the dataset SM017r.VSAM.TEST2 is already having data.
           
//JOB00013 JOB (EWDS),'ACCESS METHOD',NOTIFY=SYSUID     
//STEP0001 EXEC PGM=IDCAMS                              
//SYSPRINT DD   SYSOUT=*                                
//SYSIN    DD *                                         
  ALTER SM017R.TEST.VSAM2          -                    
  NEWNAME (SM017R.TEST.VSAM3)      -                    
  RECORDSIZE ( 160 160)                                 
/*                                                      

IDCAMS  SYSTEM SERVICES                                           TIME
                                                                     
                                                                     
     ALTER SM017R.TEST.VSAM2          -                              
     NEWNAME (SM017R.TEST.VSAM3)      -                               
     RECORDSIZE ( 160 160)                                           
                                                                     
IDC3539I KEYS AND/OR RECORDSIZE PARAMETER SPECIFIED FOR NON-EMPTY OBJE
IDC0532I **ENTRY SM017R.TEST.VSAM2 NOT ALTERED                       
                                                                     
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12                   

Example 1: Changing the name of the VSAM dataset

***************************** Top of Data ******************************
//JOB00013 JOB (EWDS),'ACCESS METHOD',NOTIFY=SYSUID                    
//STEP0001 EXEC PGM=IDCAMS                                             
//SYSPRINT DD   SYSOUT=*                                               
//SYSIN    DD *                                                         
  ALTER SM017R.TEST.VSAM2          -                                   
  NEWNAME (SM017R.TEST.VSAM3)                                          
/*                                                                     
**************************** Bottom of Data ****************************
            SSO output:
           
                                                            
   ALTER SM017R.TEST.VSAM2          -                      
   NEWNAME (SM017R.TEST.VSAM3)                             
                                                           
 IDC0531I ENTRY SM017R.TEST.VSAM2 ALTERED                  
                                                            
 IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0 
                                                                                                                                            

No comments:

Post a Comment