HP3000-L Archives

March 2005, Week 2

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:
"Vance, Jeff H (Cupertino)" <[log in to unmask]>
Reply To:
Vance, Jeff H (Cupertino)
Date:
Fri, 11 Mar 2005 20:36:45 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (124 lines)
I have a few comments, FWIW: 
...
> Here is what I have so far:
> ANYPARM _ANYPARM=AOS 
I'd comment what the 1st word of the parm value controls: A=tell
mgr.acct, O=tellop, 
    S=if job streamed by a session tell that session, else local echo.
 
> #!HPJOBTYPE!HPJOBNUM !HPJOBNAME !HPSPOOLID 
> SETVAR _TEMPSTRING ANYPARM(!_ANYPARM) 
> SETVAR _LIST WORD('!_TEMPSTRING',,1) 
I'd write this as:
  setvar _list ups(word(_tempstring))
This saves you 3 UPS() calls below and solves a quote problem mentioned
below.

> SETVAR _MSG XWORD('!_TEMPSTRING',,1) 
ditto, but this is just a personal "style" remark.

Note: if this script is invoked with an anyparm value of "" you get
different results than if invoked with a value of '' -- due to the quote
choice used above.  Just another reason it is usually better not to use
"!var" when the variable you are passing to a function already is a
string.  

Also note: passing "" or '' as the parm value is not the empty string
since it is an anyparm parm.
Anyparm treats what is passed to it literally.

> IF _MSG = ""
>    SETVAR _MSG "!HPJOBNAME #!HPJOBTYPE!HPJOBNUM !HPSPOOLID"
This is a good time to use !var, IMO. An alternative is:
     setvar _msg hpjobname+" #"+hpjobtype+"!hpjobname"+" "+hpspoolid"
which is likely slower to execute.

> ENDIF
> IF POS('A',UPS(_LIST)) > 0
             ^^^

>    IF JOBCNT('MGR.!HPACCOUNT') > 1
>       TELL MGR.!HPACCOUNT !_MSG
You could go through the trouble of insuring all matching job/sessions
are able to accept TELLs by passing the 2nd parm to jobcnt() and using
jinfo(jobID,"quiet")

>    ENDIF
> ENDIF
> IF POS('O',UPS(_LIST)) > 0
             ^^^

>    TELLOP !_MSG
> ENDIF
> IF POS('S',UPS(_LIST)) > 0
             ^^^

>    IF STR('!HPSTREAMEDBY',![(POS('#','!HPSTREAMEDBY')+1)],1)= 'S'
     if str(hpstreamedby,pos('#',hpstreamedby)+1),1) = 'S' then 
or...if lft(word(hpstreamedby,"(#)",-2),1) = 'S' then 
but... may not work well when hpstreamedby has the value "SYSTEM
PROCESS", see help.
also... hpstreamedby won't contain the logon session's id if that
session was STARTSESS'd.

>       IF HPJOBTYPE = 'J'
>          TELL ![WORD('!HPSTREAMEDBY',,3)] !_MSG
assumes the job always has a jobname, else you'll get "".

>       ELSE
>          ECHO !_MSG
>       ENDIF
>    ENDIF
> ENDIF
> IF HPCMDTRACE = FALSE
  if not hpcmdtrace then
personal preference...

>    DELETEVAR _TEMPSTRING,_LIST,_MSG
> ELSE
>    SHOWVAR _TEMPSTRING,_LIST,_MSG
> ENDIF
> 
> I know that I want to add a check before the first TELL for 
> actual users, to avoid that error. While jobcnt can tell me 
> how many there are, how can I tell if they will in fact 
> receive such a message? Perhaps those errors are unavoidable, 
> short of building and parsing my own list of such users.

See comment above about using the 'joblist_var' parm for jobcnt() and
then using 
jinfo(...,'quiet')

> And one nicety I could not come up with is a way to not 
> bother with the first word of the parm. I would need to test 
> that first word for any of the three expected values, but 
> only some combination of those three. And a simple test for 
> their existence when optional might fail on a first word 
> containing anyone of those three letters. If I could sum up 
> the number of times each letter occurs once, and compare that 
> to the length, that should work (assuming messages do not 
> begin with As, OS, So or SOA). 
Not a safe assumption, IMO.

> But I don't see a simple way 
> to get the number of times each letter occurs once. I could 
> set a variable to the first word, test it for the existence 
> of each letter, and when found, substitute some token for 
> each letter, then test for a string of just those tokens. 
> That seems awfully involved. But maybe parm processing has to be.

Not quite sure what you are trying to solve here, but it reads like you
don't want to have an explicit word/token control who receives the
message -- maybe just rely on the 1st few letter of the 1st word of the
msg??  Not sure of the value of this since it seems to me like you will
still need to instrument all messages in all jobs and scripts which want
to take advantage of your new tell facility.  If that is the case then I
think an explicit control word is desirable. But I am probably missing
some subtlety here...

HTH,
 Jeff Vance, vCSY

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

ATOM RSS1 RSS2