How to reset the RC=12 for a SCAN REALVOLS if no volume found

Document ID : KB000115230
Last Modified Date : 18/09/2018
Show Technical Document Details
Introduction:
The customer runs periodically a SCAN REALVOLS for a certain volume range to make sure any data sets are backed up if the a volume exists.
Usually, there are no volumes existing in that range so the Backup fails with RC=12.
How to reset the RC=12 for a SCAN REALVOLS if no volume selected?
Question:
How to reset the RC=12 for a SCAN REALVOLS if no volume selected?
Answer:
There is no Sysparm that could reset this RC=12. 
However, you can easily avoid the RC=12 with an additional dummy volser (which has no files), e.g. in addition to the range XXX/: 
SELECT VOL=(XXX/,VOL123) 

With CA Vantage Automation, you could set up a script that monitors the volume range and triggers an alert and job whenever a volume is found. 

Without CA Vantage, you might still be able to do something similar in several steps. 
At first, use a step that checks if there are any volumes in the range, 
then set up or generate the backup step or alert. 

To check if a volume exists in a range XXX, you could first do a volume report: 
//STEP01 EXEC DMS 
//SYSIN DD * 
SCAN REALVOLS 
SELECT VOL=XXX/ 
VREPORT ALLOCS 
/* 

The VREPORT creates one line per volume, for example: 
DEVICE UNIT SMS --DATA SET CONTROL BLOCKS (DSCB) COUNTS-- 
VOLUME TYPE ADDR STAT FREE F1/8 F2 F3 F4 F5 
------ ------ ---- ---- ------------------------------------------ ... 
XXX99A 3390 01CF NONE 38 9 1 1 1 
XXX99B 3390 22CA NONE 265 403 30 1 1 
XXX99C 3390 2D47 SMS 1687 548 13 1 1 

Again, the VREPORT step would get the same RC=12 if no volume exists with message - 
ADSST202 2860 TOTAL VOLUMES PROCESSED = 0 
The RC=12 could be avoided again if an existing dummy volser is added, for example: 
SELECT VOL=(XXX/,VOL123) 
which will not be considered during the later backup.