Hi all,
John found two errors in the command file I posted last night, which just goes
to show that you should not add comments and "fix it up a bit" without
re-testing! Thanks John!
Jeff Vance
--- Forwarded mail from <[log in to unmask]>
Date: 25 Jan 1996 05:56:05 GMT
Reply-To: <[log in to unmask]>
From: "John Dunlop" <[log in to unmask]>
Subject: Spoolfile Number
To: [log in to unmask]
PARM jobnum=!hplastjob, rtnvar=spid, entry=main
# (This command file assumes Express 3 release, if you are not on Express 3
# then change all '#' to 'comment' and change '!hplastjob' to ''.)
#
# This command file returns the spoolfile id (Onnnnnnn) in the CI variable
# named in the "rtnvar" parm. To reference this file you may need to
# append ".OUT.HPSPOOL" to the value in "rtn_parm". Example:
# :jobspid #J123 spid
# :print !spid.out.hpspool
JV: ^
JV: Even though this is a comment the !varname is dereferenced, so I need 2
JV: bangs or maybe spell it out:
JV: # :print <bang>spid.out.hpspool
#
if '!entry' = 'main' then
# main entry, redirect output of :listspf
errclear
setvar !rntvar ''
JV: ^^
JV: Classic error of mine is to reverse two letters...
JV: should read: setvar !rtnvar ''
# could syntax check jobnum parm here...
listspf O@;seleq=[JOBNUM=!jobnum AND FILEDES=$stdlist] >./jobspid_tmp
if hpcierr <> 0 then
# listspf couldn't find job
echo !jobnum not found.
escape
else
xeq !hpfile !jobnum, !rtnvar, entry=parse_listspf <./jobspid_tmp
deletevar _job2spid_@
return
endif
elseif '!entry' = 'parse_listspf' then
# listspf input has been redirected to TEMP file ./jobspid_tmp
# throw away 1st 3 lines.
input _jobspid_rec
input _jobspid_rec
input _jobspid_rec
setvar !rtnvar rtrim(str(input(),2,8))
return
endif
>I've put this script on jazz under Sources and Binaries / Scripts
JV: The version on jazz is correct.
JV: Below is a command file that John uses for the same purpose:
----------------------------------------------------------------
I include one I have been using for a while.
In a job I do the following :
!showout > $newpass
!spid < $oldpass
The SPID command file :
setvar n finfo(hpstdin,"eof")
Comment *******************************************************
Comment * [SPID] Command file to return OPENED $STDLIST number*
Comment * of current $STDLIST in variable SPOOLID. *
Comment *******************************************************
Comment * Author : J.Dunlop Date : 25/11/95 Version : A.01 *
Comment *******************************************************
while setvar(n,n-1)>=0 and len(setvar(buf,rtrim(input())))>=0
if pos("$STDLIST","!buf") > 0 and pos("OPENED","!buf") > 0
setvar spoolid str("!buf",11,9)
setvar spoolid rtrim("!spoolid")
echo !spoolid
return
endif
endwhile
Cheers,
John Dunlop ([log in to unmask])
---End of forwarded mail from <[log in to unmask]>
--
|