There's a slight bug in there somewhere which on my 1.8 and 1.9 systems only
shows the first 25 volumes and I can't beck level at the moment but this
should help to start as I used to use parts of this for that exact purpose:

(Origin unknown but its helped me over the years:)

Arg parms                                                    
If parms = '?' Then Do                                       
  Say 'QTD shows a list of all TAPEs and/or DASDs'           
  Say ' '                                                    
  Say 'Syntax:  QTD  unit  status'                           
  Say ' '                                                    
  Say 'unit: TAPE    : only tape-units are listed'           
  Say '      DASD    : only dasd-units are listed'           
  Say '      Default : tape and dasd units are listed'       
  Say ' '                                                    
  Say 'status: ONLINE  : only online units are listed'       
  Say '        OFFLINE : only offline units are listed'      
  Say '        ALL     : online and offline units are listed'
  Say '        Default : ONLINE'                             
  Say ' '                                                    
  Say ' '                                                    
  Exit 0                                                     
End                                                          
numofparms = Words(parms)                                    
If numofparms > 0 Then Do loop = 1 Until numofparms = 0      
  parm = Subword(parms,1,1)                                  
  parms = Delword(parms,1,1)                                 
  numofparms = numofparms - 1                                
  Select                                                     
    When Abbrev('TAPE',parm,1) = 1 Then qrylist = 'TAPE'     
    When Abbrev('DASD',parm,1) = 1 Then qrylist = 'DASD'     
    When Abbrev('ONLINE',parm,2) = 1 Then qrystatus = 'ONL'  
    When Abbrev('OFFLINE',parm,2) = 1 Then qrystatus = 'OFF' 
    When Abbrev('ALL',parm,1) = 1 Then qrystatus = 'ALL'     
    Otherwise Do                                             
      Say 'Given parameter(s):' Arg(1)                       
      Say ' '                                                
      Say 'Unknown parameter:' parm                          
      Exit 1                                                 
    End                                                      
  End                                                        
End                                                          
ac = Storage(00000010,4)                                     
ad = C2d(ac)                                                 
ad = ad + 1252                                               
ax = D2x(ad)                                                 
ac = Storage(ax,4)                                           
ad = C2d(ac)                                                 
ax = D2x(ad)                                                 
Do loop = 1 Until ad = 0                                     
  sc = Storage(ax,48)                                        
  cuu = Substr(sc,14,3)                                      
  ucbtyp = Substr(sc,19,1)                                   
  Select                                                     
    When C2d(ucbtyp) = 32 Then unit = 'DASD'                 
    When C2d(ucbtyp) = 128 Then unit = 'TAPE'                
    Otherwise unit = ' '                                     
  End                                                        
  volser = Substr(sc,29,6)                                   
  ucbstab = Substr(sc,35,1)                                  
  ucbstab = C2d(ucbstab)                                     
  Select                                                     
    When unit = 'DASD' Then                                  
    Select                                                   
      When ucbstab = 0 Then status = 'OFFLINE'               
      When ucbstab = 4 Then status = 'ONLINE/STORAGE'        
      When ucbstab = 16 Then status = 'ONLINE/PRIVATE'       
      When ucbstab = 80 Then status = 'ONLINE/PAGEVOL'       
      Otherwise status = 'Unknown'                                
    End                                                           
    When unit = 'TAPE' Then                                       
    Select                                                        
      When ucbstab = 0 Then status = 'ONLINE/FREE'                
      When ucbstab = 16 Then status = 'ONLINE/ALLOCATED'          
      When ucbstab = 128 Then status = 'OFFLINE'                  
      Otherwise status = 'Unknown'                                
    End                                                           
    Otherwise Nop                                                 
  End                                                             
  IF unit ^= ' ' Then Do                                          
    Select                                                        
      When qrylist = 'ALL' & qrystatus = 'ALL' Then ,             
       Say unit cuu volser status                                 
      When qrylist = 'ALL' & qrystatus = SUBSTR(status,1,3) Then ,
       Say unit cuu volser status                                 
      When qrylist = unit & qrystatus = 'ALL' Then ,              
       Say unit cuu volser status                                 
      When qrylist = unit & qrystatus = SUBSTR(status,1,3) Then , 
       Say unit cuu volser status                                 
      Otherwise Nop                                               
    End                                                           
  End                                                             
  ac = Substr(sc,9,4)                                             
  ad = C2d(ac)                                                    
  ax = D2x(ad)                                                    
End                                                               
Exit 0                                                            

Seb

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to