Detect dataset usage and reallocate If the threshold is exceeded
search cancel

Detect dataset usage and reallocate If the threshold is exceeded

book

Article ID: 264830

calendar_today

Updated On:

Products

Disk Backup and Restore - MVS

Issue/Introduction

A requirement to monitor the dataset usage to avoid x37 abend in IFASMFDP for SCRT report. 
If the threshold is exceeded, rename and reallocate the dataset.

Any ways to meet the requirement in Disk ?   

//IFASMFDP EXEC PGM=IFASMFDP                     
//SYSPRINT DD SYSOUT=*                           
//SYSUT1   DD DSN=SYS1.MANx,DISP=SHR            
//SYSUT2   DD DSN=SCRT.SMF,DISP=MOD     --> rename/realloc when the threshold is exceeded    
//SYSIN    DD *                                  
  INDD(SYSUT1,OPTIONS(DUMP))                     

 

Environment

Release : 14.0

Resolution

Using PCTUSED in SELECT CRITERIA can meet the requirement.

Sample JCL :

//*****************************************************************  
//* STEP1 CHK :  CHECK IF THE DATASET USAGE > nn%                    
//*****************************************************************  
//     JCLLIB ORDER=DISK14.PROCLIB                          
//CHK      EXEC DMS                                                  
//SYSIN    DD   *                                                    
FIND DSN=SCRT.SMF                                              
SELECT DSN=SCRT.SMF,CRI=(PCTUSED,GT,nn,AND,EXTENTS,EQ,16)                        
COPY NEWNAME=dataset.GDG(+1),TOVOL=(vol)                  
/*                                                                   
//*****************************************************************  
//* STEP2 : IF RC=00 THE DATASET USAGE >  nn%, DEL/DEF THE DATASET  
//*       : IF RC=04 THE DATASET USAGE <= nn%  GO TO STEP3          
//*****************************************************************  
//DEL     EXEC PGM=IEFBR14,COND=(0,NE)                               
//SCRTDD   DD DSN=SCRT.SMF,DISP=(OLD,DELETE),                    
//            UNIT=SYSDA,VOL=SER=vol                            
/*                                                                   
//DEF     EXEC PGM=IEFBR14,COND=(0,NE)                               
//SCRTDD   DD DSN=SCRT.SMF,DISP=(,CATLG),                        
//            UNIT=SYSDA,VOL=SER=vol,SPACE=(CYL,(nn,nn)),          
//            DCB=LRECL=nnnnn                                      
/*                                                                   
//*****************************************************************  
//* STEP3 DUMP SMP DATA                                              
//*****************************************************************  
//IFASMFDP EXEC PGM=IFASMFDP                                         
//SYSPRINT DD SYSOUT=*                                               
//SYSUT1   DD DSN=SYS1.MANx,DISP=SHR                                
//SYSUT2   DD DSN=SCRT.SMF,DISP=MOD                              
//SYSIN    DD *                                                      
  INDD(SYSUT1,OPTIONS(DUMP))                        

STEP1 :
FIND the output dataset to be set on DD SYSUT2 for IFASMFDP.
If it is found, check the "Percent used (number)" by CRI=(PCTUSED,op,nn,AND,EXTENTS,EQ,16) with SELECT.
When the condition is matched, COPY to another GDG data set to save the data.

STEP2 :
STEP1 returns 00 when the condition is matched. The dataset can be deleted and reallocated.
STEP1 returns other than 00 when the condition is not matched because PCTUSED is less than nn%.  No need to del/def the dataset.

STEP3 :
Dump SMF data.
The output dataset for DD SYSUT2 is always less than xx% before the step is executed.