%external %routine %spec set return code(%integer flag) %external %integer %function %spec return code %external %routine %spec detach(%string (255) s) %external %routine %spec detachjob(%string (255) s) %external %routine %spec prompt(%string (255) s) %external %routine %spec destroy(%string (255) s) %external %integer %function %spec exist(%string (255) s) %systemroutinespec move(%integer len,from,to) %system %routine %spec ssmessa(%integer flag, %string (63) fname) %system %routine %spec outfile(%string (31) file, %integer size, hole, prot, %c %integer %name conad, flag) %routine makefile(%string (255) ownfile) %integer flag, conad, i, j %on %event 9 %start ->out %finish destroy(ownfile) %if exist(ownfile) # 0 outfile(ownfile, 4096, 0, X'40000000' {temp file}, conad, flag) %if flag # 0 %then ssmessa(flag, ownfile) %and ->err printstring("Enter contents of job file. Finish by typing Ctrl-Y") prompt("Batch:") newline i = conad + 32 %cycle j = i, 1, i + 4000 readsymbol(byteinteger(j)) %repeat out: integer(conad) = j - conad integer(conad + 4) = 32 integer(conad + 8) = j - conad - 32 integer(conad + 12) = 3 %if j - conad - 32 = 0 %start flag = 233 ssmessa(flag, ownfile." is empty!") %finish err: set return code(flag) %end %routine makeparams(%string (255) ownfile) %constinteger l = 27 %constbyteintegerarray p(0:27)= 'O','U','T','=','F','I','L','E',X'0A', 'O','U','T','N','A','M','E','=','S','#','J','J','N',X'0A', '.','E','N','D',X'0A' %integer conad, flag, i, j destroy(ownfile) %if exist(ownfile) # 0 outfile(ownfile, 50, 0, X'40000000', conad, flag) %if flag # 0 %then ssmessa(flag, ownfile) %and ->err i = conad + 32 move(l,addr(p(0)),conad+32) integer(conad) =32+l integer(conad + 4) =32 integer(conad + 8) =l integer(conad + 12) =3 err: set return code(flag) %end %external %routine hasp(%string (255) time) %constant %string (8) detfile="T#DETACH" %constant %string (8) parfile="T#PARAMS" %constant %string (1) comma="," %string (255) line %on %event 9 %start detach(line) ->out %finish makeparams(parfile) ->err %if return code # 0 makefile(detfile) ->err %if return code # 0 line = detfile.comma.time.comma.parfile prompt("Command or Job Interpreter:") %while nextsymbol # 'j' %and nextsymbol # 'J' %and %c nextsymbol # 'c' %and nextsymbol # 'C' %cycle skipsymbol %repeat %if nextsymbol = 'j' %or nextsymbol = 'J' %then detachjob(line) %else %c detach(line) %while nextsymbol # nl %cycle skipsymbol %repeat out: %if return code # 0 {from detach or detachjob} %start printstring("Well, you could always try DETACHing ".detfile. %c " yourself") newline %return %finish err: destroy("S#JJN") %if exist("S#JJN") # 0 destroy(detfile) %if exist(detfile) # 0 destroy(parfile) %if exist(parfile) # 0 %end %end %of %file