Jeff replied with a very 'smart' example.
HP-3000 Systems Discussion <[log in to unmask]> wrote on 10/20/2003
05:00:35 PM:
> > I am trying to write a command file to list all the jobs in a
> > particular account...snip
>
> There have been some good suggestions, including an answer to the
> fundamental problem of not realizing that, by default, I/O
> redirection goes to a TEMP file and that a file equation is
> required to alter the output file defaults.
>
> However, below is an example (barely tested) that does what you
> requested, without using the SHOWJOB command. This requires 7.0+,
> I believe.
It works on 6.0 PP2
Here is my version of a command file that is a bit more involved and it
provides more flexibility in selecting records out of the output of the
'showjob' command.
Just 'cut and paste' it to name of your choice.
Regards
Paul Christidis
-------------------Start Cut *+1
parm select ="" entry='MaIn'
#
# Code for executing within MPEX to avoid error due to way MPEX
# evaluates conditional expressions.
#
setvar insidempex,0
if "!entry" = "MaIn" AND (insidempex <> 0 OR hpcmdnum=0) then
run CI.PUB.SYS;PARM=3;info='!hpfile ![ANYPARM(!select)]'
return
endif
#
if "!entry" = "ReAdIt" then
setvar mpexfinfoany 1
setvar ShowJob_Count 0
while (POS("$eod$",(SETVAR(_sj_Text,INPUT()))) = 0) do
if LFT(_sj_Text,1) = "#" then
if POS("!_sj_Select",_sj_Text) <> 0 then
echo !_sj_Text
setvar ShowJob_Count ShowJob_Count + 1
endif
else
echo !_sj_Text
endif
endwhile
deletevar mpexfinfoany
# (return to myself in the "main" entry code)
return
else
setvar _sj_Select UPS("!select")
setvar _sj_Jobq_Spec ""
if BOUND(ShowJobQueue) AND ShowJobQueue then
setvar _sj_Jobq_Spec ";JOBQ"
endif
if _sj_Select = "?" then
echo (PHC) Flexible ShowJob command V2003.10.21 !hpdatef, !hptimef
echo Usage: ![BASENAME(hpfile)] [ SJ_parm ] ![CHR(7)]
echo
echo Produces a more 'flexible' "showjob" listing. It has a number
echo of 'pre-defined' parameter values plus wild-card capability.
echo
echo SJ_parm - Optional parameter directing the selection of the
echo generated 'showjob' records, with the following values:
echo
echo 1. "?" - Displays command file's 'usage' information.
echo 2. "" - Displays all JOBS and SESSIONS in the system.
echo 3. "J" - Displays all BATCH JOBS in the system.
echo 4. "S" - Displays all SESSIONS in the system.
echo 5. "X" - Displays all BATCH JOBS in the EXEC state.
echo 6. ".acctname" - Displays all JOBS and SESSIONS for indicated
echo MPE account.
echo 7. "string" - Displays all showjob records containing the
echo indicted string.
echo
echo NOTE: The setting of the CI variable "ShowJobQueue" to a 'true'
echo value causes the command file to include any 'job queue'
echo information in its display. Also a '~' char in the FIRST
echo position of the string, acts as an 'escape' character.
#
elseif _sj_Select = "" then
showjob job=@!_sj_Jobq_Spec
elseif _sj_Select = "J" then
showjob job=@J!_sj_Jobq_Spec
elseif _sj_Select = "S" then
showjob job=@S
elseif _sj_Select = "X" then
showjob job=@j;EXEC!_sj_Jobq_Spec
elseif LFT(_sj_Select,1) = "." then
showjob job=@!_sj_Select!_sj_Jobq_Spec
else
if LFT(_sj_Select,1) = "~" AND LEN(_sj_Select) > 1 then
setvar _sj_Select _sj_Select - "~"
endif
showjob job=@!_sj_Jobq_Spec > xsjfilex
echo $eod$ >> xsjfilex
xeq !hpfile _sj_Select ;entry="ReAdIt" < xsjfilex
purge xsjfilex,temp > $null
echo
setvar _sj_Suffix "s"
if ShowJob_Count = 1 then
setvar _sj_Suffix ""
endif
echo *** !ShowJob_Count Item!_sj_Suffix qualified. *** ![chr(7)]
echo
endif
endif
if BOUND(traceon) AND traceon then
showvar _sj@
else
deletevar _sj@
endif
-------------------End Cut *-1
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|