parm file=ACCTUVOL fileset=/[A-Z]@/[A-Z]@ entry=main # # This script creates the user volume mapping file, referred to as the # "acctuvol" file. This file is populated with all existing groups that # are homed to a user volume. # Syntax: blduvol [config_filename] [/ACCT/GRP] # where: # "config_name" is the filename for the user volume to grp.acct # mapping file, default is "acctuvol" # "/ACCT/GRP" is the fileset for :listfile to list. It should name # the groups and accounts you are interested in including in the # acctuvol file. Default is all groups on your system. # if '!entry' = 'main' then echo !hpfile !hptimef Version A.03 echo errclear if finfo('!file','exists') then echo "!file" already exists. Purge this file and try again. return endif echo Creating User Volume Config file: !file continue listfile !fileset,6;seleq=[object=group] >uvoltmp if cierror <> 0 then echo :listfile !fileset,6;seleq=[object=group] echo !hpcierrmsg return endif setvar _blduvol_eof finfo('uvoltmp','eof') echo !hptimef echo You have !_blduvol_eof groups matching "!fileset" # calculation below is based on processing approx 5,000 groups/minute if _blduvol_eof > 2500 then echo Expect approx ![(_blduvol_eof+2500)/5000] minutes to complete endif # invoke alt_lf entry to process listfile,6 data xeq !hpfile !file !fileset entry=alt_lf !file echo !hptimef echo echo !_blduvol_cnt groups live on user volume sets if _blduvol_cnt = 0 then echo No entries have been added to config file "!file". else echo Please review the user volume config file "!file". endif echo # save "file" as permanent continue save !file deletevar _blduvol_@ return elseif '!entry' = 'alt_lf' then # Input redirected from listfile,6 with _blduvol_eof already set. # Output redirected to "file" which is the acctuvol file so don't do # any echos to the user's $stdlist from here!! # write config file header comments echo # This config file maps [group.]accounts to user volume sets. echo # More specific entries should precede more generic entries. echo # Wildcarding is fully supported. (Produced by the !hpfile script) # initialization for while loop below setvar _blduvol_prevacct '' setvar _blduvol_prevvol '' setvar _blduvol_samevols false setvar _blduvol_cnt 0 while setvar(_blduvol_eof,_blduvol_eof-1) >= 0 do # read input file setvar _blduvol_name input() setvar _blduvol_acct word(_blduvol_name,'/',2) setvar _blduvol_vol finfo(_blduvol_name,'volume set name') # report progress every 1000 groups if (_blduvol_eof mod 1000 = 100) and hpinteractive then file bldterm;dev=!hpldevlist echo progress: processing account "!_blduvol_acct"... >*bldterm reset bldterm endif # see if all groups in the same acct reside on the same volset if _blduvol_acct <> _blduvol_prevacct then # account break: write non-system vols entry to acctuvol. if _blduvol_samevols and & _blduvol_prevvol <> 'MPEXL_SYSTEM_VOLUME_SET' then # all groups on volsets in this account are homed to the same USER # volset. Indicate this in the config file. echo !_blduvol_prevacct ![rpt(' ',17-len(_blduvol_prevacct))] & !_blduvol_prevvol endif setvar _blduvol_prevacct _blduvol_acct setvar _blduvol_samevols true elseif _blduvol_vol <> _blduvol_prevvol then # this group is in the same acct as the prior group but is homed to # a different user volume set - set samevols false for entire acct setvar _blduvol_samevols false endif setvar _blduvol_prevvol _blduvol_vol if _blduvol_vol <> 'MPEXL_SYSTEM_VOLUME_SET' then # increment total count setvar _blduvol_cnt _blduvol_cnt+1 endif endwhile # out of while loop. Handle the last acct which is not done in while above. # end-of-loop processing: write non-system vols entry to acctuvol. if _blduvol_samevols and _blduvol_vol <> 'MPEXL_SYSTEM_VOLUME_SET' then # all groups on volsets in this account are homed to the same USER # volset. Indicate this in the config file. echo !_blduvol_acct ![rpt(' ',17-len(_blduvol_acct))] !_blduvol_vol endif return endif # Version History: A.03 - fixed bug where progress reporting was done in jobs.....:( A.02 - no longer add specific grp.acct entries to acctuvol file. If all groups in an acct are on the same volset then an acct-only entry is appended. This reflects that most of the usefulness of acctuvol is for generic entries where the customer has [grp.]acct naming pattern conventions and for :newgroup with acct-only entries. Also added progress reporting. A.01 - logic related to "are all grps in an acct on the same volset?" was changed to include the sys volset. Fixed bug where last entry from :listfile was not processed. A.00 - added "array" to store all grp names in an acct. If all grps not in same volset then specific grp.acct entry appended to acctuvol. 0000 - first version. Jeff Vance, CSY, 1998-03-12