! TASK.BAS - Create a .CTL file for a .CMD/.RUN and SUBMIT it. 10/85
!
! Evan N. Oulashin, Portland Radio Supply
!
! 10/12/85 - Donated to AMUS
! 10/16/85 - Updated version sent to AMUS
!
! Compile and install in 7,6
!
! Requires AMOS.SBR, available on AMUS system
! Requires JOBNAM.SBR, also available as above
!
! Submits .CMD or .RUN jobs to the TASK MANAGER.
! Written for 1.3, should run under previous versions with the
! exception that PRIORITY has changed from earlier versions
! to 1.3. As of this date, 1.3 has an error in that the
! default priority for SUBMIT is 256, which under 1.3 is
! an illegal priority! We get around that by specifying
! /PRI:13, which seems to be default priority under 1.3.
!
!
! Also place following file in 2,2:
!
!;TASK.DO - COMMAND FILE TO CREATE AND SUBMIT A CONTROL FILE TO TASK MANAGER
!; USE WITH TASK.BAS IN 7,6
!:R
!RUN TASK
!$0
!
!;END OF TASK.DO
!
! USAGE: TASK command{.EXT} {[P,PPN]}
!
! Program checks for specific PPN in argument, id'd by
! presence of [] in argument. If not found, it then checks
! .CMD, .CMD[2,2], .RUN, .RUN[7,6] in that order and when
! found, submits a control file, TMPx.CTL, which executes
! the command. Otherwise it uses the specified command with
! ppn and creates the control file and executes it.
!
! As written, this program directs Task Manager to log to 7,0.
! Should you prefer, you may change this by modifying the
! variable RUN'PPN to suit.
!
! It will be more convenient to set RUN'PPN to the ppn where
! you will typically execute this command, since the command
! files will reside there. Otherwise, specify the PPN where
! the command file lives.
!
! EXAMPLE: Create a command file called SDF.CMD, which will look like:
! :R
! DIR
!
! From command level, enter TASK SDF. This will cause
! the Task Manager to execute a directory.
MAP1 VARS
MAP2 JOB ,S,6
MAP2 COMMAND ,S,50
MAP2 OUTFILE ,S,25
MAP2 PRGNAME ,S,30
MAP2 TNAME ,S,30
MAP2 EXTS(4) ,S,13
MAP2 MAXEXT ,F,6 ,4
MAP2 RUN'PPN ,S,7 ,"7,0" ! Modify to suit - see text
PROC:
XCALL JOBNAM,JOB
XCALL STRIP,JOB
DATA ".CMD",".CMD[2,2]",".RUN",".RUN[7,6]"
FOR L = 1 TO MAXEXT
READ EXTS(L)
NEXT L
INPUT LINE PRGNAME
IF INSTR(1,PRGNAME,"[") &
TNAME = PRGNAME: &
LOOKUP TNAME,FOUND: &
GOTO ISITTHERE
A = INSTR(1,PRGNAME,".")
IF A PRGNAME = PRGNAME[1,A-1]
FOR L = 1 TO MAXEXT
TNAME = PRGNAME + EXTS(L)
CALL CHECK
IF FOUND LX=L: L=MAXEXT
NEXT L
ISITTHERE:
IF FOUND GOTO FOUNDIT
PRINT "Cannot find "+PRGNAME
GOTO ALL'DONE
FOUNDIT:
CALL OPEN'FILE
PRINT #14,"LOG "+RUN'PPN
IF LX<3 PRINT #14,TNAME : &
ELSE PRINT #14,"RUN "+TNAME
PRINT #14,"SEND "+JOB+" "+TNAME+" Completed."
PRINT #14,"ERASE "+OUTFILE
CLOSE #14
COMMAND = "SUBMIT "+OUTFILE+"/PRI:13"
SDD: XCALL AMOS,COMMAND
GOTO ALL'DONE
CHECK:
LOOKUP TNAME,FOUND
RETURN
OPEN'FILE:
EX=0
OL:
EX=EX+1
IF EX=1000 PRINT "TOO MANY .CTL FILES - ABORTING": ABORT=1: RETURN
OUTFILE="TMP"+EX+".CTL"
LOOKUP OUTFILE,FOUND
IF FOUND GOTO OL
OPEN #14,OUTFILE,OUTPUT
RETURN
ALL'DONE:
END