c [2,20]SPAWNR.FTN R RHODERICK AUG 1982 c USEPA/HERL/NTD c MD74B c Research Triangle Park, NC 27711 c Modified - MAR 1983 c added job priority capability, job status words c This program is spawned by the BATCH Queue Manager task (BQM...) c to run from the BATCH log device port. It decodes an MCR command c line containing the terminal to log on and slave, the logon string, c and the name of an indirect command file to give to a specially c installed copy of the DEC indirect command file processor. When the c job file completes, this task logs off the terminal (the BYE task c unslaves the terminal) and sends task BQM... it's completion status. c This task requires a copy of the DEC indirect command file processor c with the installed name of BAT... (INS $ICP/TASK=BAT.../PRI=10.), in c order to avoid conflict with ...AT. if the user's account has a c LOGIN.CMD file to execute at logon. c This program will abort execution of the user BATCH job command file c after a maximum time limit expires. This is to avoid the problem c of a job 'hanging' while waiting for input, etc. The time limit c in minutes is configurable in the variable constant ITIME found c in a PARAMETER statement at the beginning of the program. c The format of the invokation command line is: c col 1-18: the logon string to pass to the HELLO task to log c the BATCH log terminal on with (HEL ggg/mmm/paswrd) c col 19-48: the complete filespec of the BATCH command file to c execute from the BATCH log terminal, including the c indirect processor deletion switch, if required c (ddnn:[ggg,mmm]fffffffff.xxx/DE) c This program uses 3 other support programs to implement a c pseudo-BATCH system under RSX11M: c BATCH (...BAT) - user interface for BATCH command file c submission, deletion, listing c BATCH Queue Manager - receives instructions from BATCH task c (BQM...) for adding/removing requests from the BATCH c queue file, and sends commands to this SPAWNR c task for file execution. c IND (BAT...) - command files are submitted to a copy of c the DEC indirect command processor installed c with this name after the BATCH log terminal c is logged on. The indirect processor must c be invoked with a non-standard name to c avoid conflict with the ...AT. task being c automatically spawned to process any c LOGIN.CMD file when the BATCH log device c is logged on to the user's account. c This also allows the BATCH copy of IND to c be installed at a low priority (eg. c INS $IND/TASK=BAT.../PRI=10. ). c STATUS RETURNED TO BQM... AT COMPLETION: A - logon failed c B - logon successful c C - job completion c D - job aborted - timed out C--ITIME is the time limit (minutes) for execution of a BATCH job file C--IPAUSE is the number of 30-second intervals to wait before logging off C a user on the BATCH output log terminal parameter (itime=180) ! minutes to run timeout counter parameter (ipause=4) ! # of 30-sec intervals to delay forced logout byte qiobuf(2),cr character sndlin*39,byelin*3,cmd*48,tim*8,dat*9,code*1 logical*2 logdon integer*2 rec13(13),param(6),iosb(2) real mcr,bqm,batind data byelin/'BYE'/ data cr/"15/ data mcr,bqm,batind/6rMCR...,6rBQM...,6rBAT.../ data sndlin/' '/ !blank the SEND DATA buffer data qiobuf/"50,"1/ !define IO.SMC parameters - attribute 50, "set" equivalence (code,sndlin) equivalence (qiobuf,i2z) !word-align the IO.SMC attributes list call assign(1,'TI:') code='A' !tentative status code is 'logon failed' call getmcr(cmd) !retreive invoking command line do 10 i=1,ipause call chklog(logdon) !see if ti: is currently logged on if(.not.logdon)goto 15 c--someone has ti: logged on - ask user to log off write(1,5)cr 5 format(1h0a1,'****** Please finish up - BATCH needs this terminal',/) call mark(4,30,2) !wait 30 seconds call waitfr(4) ! 10 continue c--if fell thru to here, user didn't log off - force "BYE" line to terminal call spawn(mcr,,,1,,,,byelin,3) call waitfr(1) c--write job heading and job file name 15 call time(tim) call date(dat) write(1,25)cr,tim,dat,cmd(19:45) 25 format(1h1a1,78('*')/1h '** ',a8,x,a9, +' *** START BATCH JOB *** ',a27,' **',/) c--spawn hello with logon string we were invoked with call spawn(mcr,,,1,,,,cmd,18) call waitfr(1) c--did the logon work??? call chklog(logdon) if(.not.logdon)goto 50 c--send data block to BQM... to signal start of job code='B' !change status to 'logged on' call irad50(39,sndlin,rec13) call send(bqm,rec13) call ustp(bqm) c--now slave the terminal call getadr(param,qiobuf) !get address of attributes list param(2)=2 !2 byte attributes list call wtqio("2440,1,1,,iosb,param) !IO.SMC c--spawn BAT... to work on user's file and start timeout counter cmd(18:18)='@' call spawn(batind,,,1,,,,cmd(18:48),35) call mark(2,itime,3) call stlor(1,2) c--wait for BAT... to finish or timeout counter to expire call readef(1,ier) c--log batch log device off call spawn(mcr,,,1,,,,byelin,3) call waitfr(1) code='C' !change status to 'successfully completed' if(ier.eq.2)goto 60 write(1,45)cr 45 format(1h0a1,t13'****** BATCH JOB ABORTED - TIME LIMIT EXCEEDED', +' ******'/) code='D' !change code to 'timed out' goto 60 c--logon to batch log device wasn't sucessful - send msg to it 50 write(1,51)cr 51 format(//a1,' SPAWNR - BAD LOGON STRING: SCHEDULED ', +'BATCH JOB NOT EXECUTED'//) 60 call time(tim) write(1,65)cr,tim,dat 65 format(1h0a1,'***** ',a8,x,a9,' ****** END BATCH JOB ', +32('*')/1h 78('*')) c--send BQM... a completion message call irad50(39,sndlin,rec13) call send(bqm,rec13) call ustp(bqm) call exit end