PARM useracct=@.!hpaccount, select=all, entry=main # Version A.03 # This script reports all of the UDC files cataloged by "useracct", the level # of the UDC (user, account, system), and the LOGON UDC command, if any. # If the user happens to be logged on an asterisk is displayed in column 1 to # indicate these UDC files are active. The 2nd parm support output filtering. # If select=active is specified then only active(logged on) user.accts are # reported, else active and inactive user.accts are shown. The two valuse for # the select= parm are "ALL"(default) and "ACTIVE". # # The "useracct" parameter can be wildcarded for both user and acct names. # if '!entry' = 'main' then if "!useracct" = "?" then echo echo ![basename(hpfile)] [ user_acct ] [ select=ALL | ACTIVE ] echo echo This script reports the UDC files cataloged by "useracct", the level of echo the UDC (user, account, system), and the LOGON UDC command, if any. If echo the user is logged on an asterisk is displayed in column one to indicate echo an "active" UDC file. echo echo [user_acct] can be wildcarded for both user and account names. Expected echo format is !.! and the default is "@.& !!HPACCOUNT". echo echo [select] controls whether the user.acct names reported include all echo known user.accts on the system, or only those that are echo currently logged on. echo "ALL" is the default select= value and no output is & filtered. echo "ACTIVE" causes all user.acct names that are not logged on to echo to be omitted, thus only UDC files of "active" users echo are displayed. echo return endif if pos('SM',hpusercapf) = 0 and pos('AM',hpusercapf) = 0 then echo You need AM or SM capabilities to execute this command. return endif # parse the select= parm setvar _cu_select dwns("!select") if _cu_select <> "all" and _cu_select <> "active" then echo Expected select= values are: "all" and "active". return endif setvar _cu_ua ups("!useracct") setvar _cu_levels "USER ACCT SYSTEM" setvar _cu_act_TRUE "*" setvar _cu_act_FALSE " " # qualify user.acct if pos('.',_cu_ua) = 0 then setvar _cu_ua _cu_ua + "." + hpaccount endif # drive the setcatalog loop via the :listuser command # Programming note: you cannot use jobcnt() to drive the setcatalog loop # when "active" is selected without first removing duplicate user.acct # entries. I decided against this, even though processing all user.accts # on a system is slower. setvar hpcierr 0 continue listuser !_cu_ua;format=brief >chkudclu if hpcierr <> 0 then print chkudclu escape endif # write header echo UserName FileName Level LogonCmd echo ----------------- -------------------------- ------ ---------------- xeq !hpfile !_cu_ua entry=read_listuser = 0 do # read the user.acct name setvar _cu_ua rtrim(input()) # determine if this user.acct should be reported if setvar(_cu_active,jobcnt(_cu_ua) > 0) or _cu_select = "all" then # show the UDCs cataloged for this user.acct setvar hpcierr 0 continue showcatalog user=!_cu_ua >chkudcsc if hpcierr <> 0 then print chkudcsc escape endif # process the showcatalog output for this user.acct xeq !hpfile !_cu_ua entry=read_showcat "" do if lft(_cu_f,3) <> "NO " then # at least 1 UDC file is cataloged at this level # delete trailing nul in filename, thanks to :showcatalog setvar _cu_f setvar(_cu_ftmp,lft(_cu_f,pos(chr(0),_cu_f)-1)) setvar _cu_logon_name "" if not _cu_logon_seen then # prepare to read this UDC file looking for 1st option logon udc # verify that user has read access to udc file setvar hpcierr 0 setvar _cu_haveR false continue listfile !_cu_f,4 >chkudclf if hpcierr = 0 then # verify read access print chkudclf;start=-1 >chkudcR # read in the last record: "FOR USER.ACCT: bla, blah, blaah" input _cu_rec 0) endif if _cu_haveR then # get the lockword, if any setvar _cu_lkwd "" setvar hpcierr 0 setvar hpmsgfence 2 continue setvar _cu_lkwd finfo(_cu_f,'lockword') setvar hpmsgfence 0 if hpcierr = 0 and _cu_lkwd <> "" then # add lockword to qualified MPE filename setvar _cu_ftmp word(_cu_f,'.')+"/" + _cu_lkwd + "." + & xword(_cu_f,'.') elseif hpcierr <> 0 then # can't get lockword, but there might not be a lockword! setvar hpcierr 0 continue print !_cu_f;end=1 >$null endif # look for first logon UDC in this file if hpcierr = 0 then xeq !hpfile _cu_logon_seen entry=read_UDC_file = 0 do # read the UDC command and parm line(s) setvar _cu_rec ups(ltrim(rtrim(input()))) # concatenate input records while rht(_cu_rec,1) = '&' do setvar _cu_eof_f _cu_eof_f - 1 setvar _cu_rec _cu_rec + ups(ltrim(rtrim(input()))) endwhile # save the UDC command name and read next record # (there are no UDC options on the command line) setvar _cu_cmd, word(_cu_rec) # read the rest of this UDC looking for OPTION LOGON while setvar(_cu_eof_f,_cu_eof_f-1) >= 0 and lft(_cu_rec,1) <> '*' do setvar _cu_rec ups(ltrim(rtrim(input()))) # concatenate input records while rht(_cu_rec,1) = '&' do setvar _cu_eof_f _cu_eof_f - 1 setvar _cu_rec _cu_rec + ups(ltrim(rtrim(input()))) endwhile if word(_cu_rec) = "OPTION" and & pos('LOGON',_cu_rec) > 0 and pos('NOLOGON',_cu_rec) = 0 then setvar !useracct true setvar _cu_logon_name _cu_cmd return endif endwhile endwhile return endif