Information
Important We are integrating BMC AMI LOBMaster technology into the BMC AMI Reorg product and discontinuing BMC AMI LOBMaster as a separate product. For the latest integrated documentation, see BMC AMI Reorg for Db2 13.1.

_sgvols() function


The _sgvols() function returns a list of all the volumes in an SMS storage group and information about each volume.

Syntax

x = _sgvols(<storageGroup>, <listVariable>)

The following table describes the parameters for this function:


Parameter

Description

storageGroup

The name of the SMS storage group (STOGROUP) for which you want a list of volumes

listVariable

(optional) A stem variable that will contain a numbered list of strings, each containing values for a single volume in the STOGROUP

If you do not supply a value, the function returns the list in the vols variable.

Values returned

The _sgvols() function returns two types of output.

The first type of output returned is the success of the function. The following table describes the values for this output:


Value

Description

OK

Successful operation with normal completion

Error message

Text that describes the nature of the error

The second type of output returned is a set of values for each volume in the STOGROUP. Each instance of the list variable (for example, vols.1, vols.2, vols.3, and so on), contains a string of numbers that indicate the following values:

  • The volume serial number
  • The amount of free space on this volume, in cylinders
  • The largest number of free extents on this volume, in cylinders

The storage group volumes are listed in descending order (from largest to smallest) by the largest free extent value. In other words, the variable vols.1 will have the information for the volume with the largest free extent, vols.2 will have the information for the volume with the second largest free extent, and so on. The variable vols.0 indicates the number of volumes returned.


Information
Examples

The following figure shows example statements in an XSUTDYNM automation control point for dynamic allocation of a data set:

 sggrp =  'XYZGROUP'  
 x = _sgvols(sggrp, vols)

The following figure shows the data that the function returns. These results indicate that volume serial XYZ283 (in vols.1) has the most free space.

vols.0   5
vols.1   'XYZ283   500    125'
vols.2   'XYZ792   423    101'
vols.3   'XYZ9E5   401    99'
vols.4   'XYZ0A3   398    97'
vols.5   'XYZ44B   371    83'

The following example shows the logic that you might use to set the primary allocation to the largest free extent in an SMS storage group:

 db2sg = 'DB2SMS'  
 x = _sgvols(db2sg, PRODVOLS)    /* PRODVOLS has volumes */
 if x = 'OK' then do  
   say 'Largest Free Extent is on Volume 'word(PRODVOLS.1,1)  
   say 'Total Free Space available is 'word(PRODVOLS.1,2)' cylinders.'  
   say 'Largest Free Extent is 'word(PRODVOLS.1,3)' cylinders.'
   primary = word(vols.1,3)
   end
 else do  
   say 'ERROR FROM _VOLSG() FUNCTION'
   say x
   rc = 8      /*  Stop processing  */
   exit  
   end


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI Reorg for Db2 13.1