HP3000-L Archives

June 2010, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Mon, 28 Jun 2010 09:37:48 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (271 lines)
wow, that is Sweet, thanks!!  I'm not surprised it's from Jeff Vance, quite
likely the ultimate master of MPE scriptology.  

surprisingly, he left room for improvement: it fails when run from inside
qedit.

tracy pierce
golden gate bridge
415 517 7175

> -----Original Message-----
> From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On Behalf
Of
> Michael Caplin
> Sent: Monday, June 28, 2010 9:03 AM
> To: [log in to unmask]
> Subject: Re: [HP3000-L] All users for a UDC
> 
> The response that I found most useful came from Simon Harryman:
> 
> 
> 
> Michael,
> There was a post by Jeff Vance some time ago about a script that he had
> written for exactly this sort of problem. Try the following - it's a copy
of
> the
> script:
> PARM [log in to unmask], 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 values
> 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 !<user!>.!<account!> and the default is
"@.&amp;
>                 !!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 <chkudclu
>    #deletevar _cu_@
>   return
> elseif '!entry' = 'read_listuser' then
>   # input redirected from the output of :listuser;format=brief
>   #
>   setvar _cu_eof_lu finfo(hpstdin,'eof')
>   # read each record in input file
>   while setvar(_cu_eof_lu,_cu_eof_lu-1) >= 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 <chkudcsc
>         echo
>      endif
>   endwhile
>   return
> elseif '!entry' = 'read_showcat' then
>   # Input has been redirected from the output of :showcatalog
user=usr.acct
>   #
>   # :showcatalog output always ends in a blank(empty) record.
>   #
>   setvar _cu_indx 0
>    while setvar(_cu_indx,_cu_indx+1) <= 3 do
>      setvar _cu_lev word(_cu_levels,,_cu_indx)
>      setvar _cu_logon_seen false
>      # skip the header record
>      input _cu_f
>       # now process all UDC files at this level
>      while setvar(_cu_f,ltrim(rtrim(input()))) <> "" 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 <chkudcR
>                  setvar _cu_haveR (pos('READ',word(_cu_rec,":",-1)) > 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
<!_cu_ftmp
>                  else
>                     setvar _cu_logon_name "(no access)"
>                  endif
>               endif
>            endif
>             # write username, filename, level and logon UDC name (if any)
>            echo !"_cu_act_!_cu_active"&
>                 !_cu_ua ![rpt(" ",17-len(_cu_ua))] !_cu_f &
>                 ![rpt(" ",26-len(_cu_f))] !_cu_lev &
>                 ![rpt(" ",6-len(_cu_lev))] !_cu_logon_name
>             # only display user.acct name once per user and clear active
flag
>            setvar _cu_ua ""
>            setvar _cu_active false
>         endif
>      endwhile
>   endwhile
>   return
> elseif '!entry' = 'read_UDC_file' then
>   # Input redirected to a UDC file.  Parm-1 is the name of the variable to
>   # indicating if an OPTION LOGON UDC command is present in this UDC file.
>   #
>   setvar _cu_eof_f finfo(hpstdin,'eof')
>   while setvar(_cu_eof_f,_cu_eof_f-1) >= 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
> If you can't get the thing to work, I can send you a copy of the file as a
> Reflection tansferred attachment.
> Regards from a warm and sunny England (shame about the soccer...),
> Simon Harryman
> Technical Support
> 
> azurri Computer Systems
> Berkeley House
> Unit 1004
> Wingates Industrial Park
> Westhoughton
> Bolton, BL5 3XU
> 
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2