Many of you were very helpful and I want to return the favor.
Here is a 'final' version of my SUBMIT command file that adds some
flexibilty to the way you can write and maintain MPE/iX Stream files.
Please feel free to use it if you find it useful or interesting.
Text of SUBMIT.UDC
parm _job,char='!',at='',day='',date='', in='',user='',group='',account='', &
jobname='',outclass='LP',inpri='',pri='ES',time='?', jobappend=''&
jobinfo=' ',replace='NO',programatic='NO',debug='NO',preprocess='NO' &
step='STEP1'
comment SUBMIT -- Flexible Stream Script that allows stream jobs to be
comment written as prototypes with variable replacement
comment in the JOB statement (and an environment variable)
comment that are resolved when the file is streamed.
comment It also allows 'normal' job statements to be
comment appended so that INPRI,OUTCLASS,PRI and TIME
comment can be specified if they are not already present.
comment Mentally replace ~ with an explanation
comment mark in the following examples
comment N.B. - Stream prototypes should be kept as an unnumbered file
comment Sample Job for SUBMIT (TESTJOB -- the STREAM prototype):
comment ~job ~hpjobname,~hpuser.~hpaccount,~hpgroup;inpri=~hpinpri; &
comment ~outclass=~hpoutclass;pri=~hpjobpri;time=~hpjobtime
comment ~ < some MPE/iX commands >
comment ~eoj
comment Written by Gary L. Biggs; Nov, 1997 after an example
comment from Wolfgang Kinscher of HP Austria
comment Usage Examples:
comment SUBMIT testjob -- job logs on with SUBMITing user information
comment SUBMIT testjob,#;at=23:00;day=MONDAY -- like STREAM command
comment SUBMIT testjob;OUTCLASS=LASERJET;INPRI=13;PRI=BS
comment -- as above with output redirected to LASERJET and
comment sent to the head of the Job Queue
comment SUBMIT oldjob;USER=manager;ACCOUNT=sys;JOBNAME=oldjob;REPLACE=yes
comment -- replaces the 1st line of a conventional stream job
comment with the prototype shown above.
comment This lets one redirect an unmodified stream file to a new logon.
comment SUBMIT oldjob;JOBAPPEND='outclass=laserjet'
comment -- takes 1st line of a conventional stream job
comment and appends the OUTCLASS option to the JOB statement to
comment redirect the output to a new printer
comment SUBMIT testjob;USER=manager/password;ACCOUNT=sys;JOBAPPEND='HIPRI'
comment -- job logs on as MANAGER.SYS with ;HIPRI added
comment to the end of the job statement (HIPRI not already specified
comment in the prototype)
comment SUBMIT testjob;JOBINFO='listf @.pub.sys'
comment -- The JOBINFO parameter passes a string from the
comment SUBMIT command to the Job Stream (SUBMIT automatically
comment inserts a definition for an environemnt variable HPJOBINFO
comment into the temporary file that will be STREAMED)
comment
comment Example of the use of the JOBINFO parameter:
comment ~job howtouse,~hpuser.~hpaccount
comment ~run ci.pub.sys;info='~HPJOBINFO' << listf @.pub.sys
comment ~setvar newcommand '~HPJOBINFO' + ',2'
comment ~~newcommand << listf @.pub.sys,2
comment ~eoj
comment SUBMIT testjob;USER=manager;ACCOUNT=sys;PROGRAMATIC
comment -- used with HPCICOMMAND intrinsic PROGRAMATIC redirects
comment the printing of the JOB number or CIERROR
comment to the variable SUBMITRESULT that can then be
comment checked for the results from the programatic
comment execution of the SUBMIT command file
if '!step' = 'STEP1' then
xeq !hpfile '!_job',user='!user',group='!group',account='!account', &
jobname='!jobname',outclass='!outclass',inpri='!inpri', &
pri='!pri',time='!time',jobappend='!jobappend',replace='!replace', &
debug='!debug',step='STEP2' <!_job
echo !char setvar hpjobinfo '!jobinfo' > *tempjob
fcopy from=!_job;to=*tempjob;subset=!_nrecs > $null
setvar timespec ' '
if '!at' > ' '
setvar timespec ';AT=' + '!AT'
endif
if '!day' > ' '
setvar timespec timespec + ';DAY=' + '!DAY'
endif
if '!date' > ' '
setvar timespec timespec + ';DATE=' + '!DATE'
endif
if '!in' > ' '
setvar timespec timespec + ';IN=' + '!IN'
endif
file tempjob,oldtemp
setvar cierror 0
if ups('!preprocess') = 'NO'
if ups('!programatic') = 'YES'
stream tempjob,!char !timespec >submitok
if cierror = 0
file submitok,oldtemp
input _l < submitok
reset submitok
setvar submitresult ltrim('!_l')
else
setvar submitresult '!cierror'
endif
purge submitok,temp
else
stream tempjob,!char !timespec
endif
purge tempjob,temp
endif
reset tempjob
deletevar _l, _nrecs, timespec, _injoblogon
else
if '!step' = 'STEP2' then
file tempjob=tempjob,oldtemp
if finfo('*tempjob','exists') then
purge tempjob,temp
endif
file tempjob;temp;disc=![finfo('!_job','end of file')+10]
fcopy from=!_job;to=*tempjob;new;subset=0,0 > $null
file tempjob=tempjob,oldtemp;acc=append
setvar _nrecs 0
setvar _injoblogon 1
while _injoblogon > 0 do
if ups('!replace') = 'YES'
setvar _l '!!job !!hpjobname,!!hpuser.!!hpaccount,!!hpgroup;' + &
'outclass=!!hpoutclass;pri=!!hpjobpri;time=!!hpjobtime;' + &
'inpri=!!hpinpri'
else
input _l
endif
setvar _l ups(_l)
setvar _nrecs, _nrecs + 1
setvar _injoblogon pos('&',_l)
if '!jobappend' > ' ' and _injoblogon = 0
setvar _l rtrim(_l) + ';'+ '!jobappend'
endif
if '!jobname' > ' '
setvar _l repl(_l,'!','!!')
setvar _l repl('!_l','!!HPJOBNAME','!JOBNAME')
endif
if '!user' > ' '
setvar _l repl(_l,'!','!!')
setvar _l repl('!_l','!!HPUSER','!USER')
endif
if '!account' > ' '
setvar _l repl(_l,'!','!!')
setvar _l repl('!_l','!!HPACCOUNT','!ACCOUNT')
endif
if '!group' > ' '
setvar _l repl(_l,'!','!!')
setvar _l repl('!_l','!!HPGROUP','!GROUP')
endif
if '!inpri' > ' '
setvar _l repl(_l,'!','!!')
setvar _l repl('!_l','!!HPINPRI','!INPRI')
endif
setvar _l repl(_l,'!','!!')
setvar _l repl('!_l','!!HPOUTCLASS','!OUTCLASS')
setvar _l repl(_l,'!','!!')
setvar _l repl('!_l','!!HPJOBPRI','!PRI')
setvar _l repl(_l,'!','!!')
setvar _l repl('!_l','!!HPJOBTIME','!TIME')
if lft(_l,1) = '!' then
setvar _l repl(_l,'!','!!',1)
endif
if ups('!debug') = 'YES'
echo !_l
endif
echo !_l >*tempjob
endwhile
endif
endif
Gary L. Biggs, N5TTO
[log in to unmask]
Interex SIG Allbase Chair
"Abandon all hope, Ye who Inter(net) here" --
Dante, over the portal(router) to Hell
|