! HELM.BAS This program edits commands submitted to the Task Manager. ! it asks for the job to be submitted, shows defaults, and allows you ! to change anything you don't like. It assumes that the file you wish ! to submit is located in the PPN you're in and has the extension .CTL ! The only thing that isn't implemented is the ability to name the ! sequence number of a job in the BATQEUand change its parameters. ! that is really tough to do from within a BASIC file, so if you have ! to change something, we suggest that you just KILL the file in the ! BATQE and resubmit it. ! This program is not copyrighted or protected in any way. Feel free ! to distribute it however you like.UIf you do distribute this, please ! give credit for the program to Alpha Micro Users Society, ! 735 Walnut Street, Boulder, CO 80302 (303) 449-6917. ! If you have suggestions, bugs, or comments, contact Steve Elliott. ! last update 9/20/84 working on building the update string ! still to do: ! * Write up the help file map1 input'bucket,s,30 map1 file'name,s,10 map1 default'file'name,s,6,"" map1 default'extension,s,6,"ctl" map1 submit'string,s,150 ! I hope your terminal buffer size ! is long enough to handle a really ! long submission command!!!!!! ! Abbreviations are used, but it ! can get out of hand if there are ! a lot of dates in the line. map1 x,f ! work variable map1 n,f ! for/next loop counter map1 dummy,s,1 ! well known dummy map1 prompt(15),s,40 ! screen prompts map1 default(15),s,30 ! task manager defaults map1 error'choice,s,7 ! NONE, WARNING, FATAL, or ALL map1 todays'date,b,4 map1 bogus'label,@todays'date map2 month,b,1 map2 day,b,1 map2 year,b,1 map1 log'file,s,10 ! defaults to file'name.log map1 month'string,s,2 ! used to set leading zeroes map1 day'string,s,2 ! in a string that becomes map1 year'string,s,2 ! default(n) map1 abs'or'rel,s,1,"" ! absolute or realtive dating map1 Z,s,2,"#Z" ! leading zeroes map1 ampm,s,2 ! no military time, please map1 set'flag(15),f ! 1 = assemble this command ! because something has been changed initialization: ? tab(-1,0); ? tab(2,25); "Helm awaits your command..." ? tab(3,25); "Ready to submit a file to the Task Manager" call load'prompts'and'defaults call get'date'and'time try'another'name: call enter'file'name if give'up = 1 & then & goto quit call lookup'file if x = 0 & then & file'name= "" : input'bucket = "" :& goto try'another'name The'guts'of'the'program: ? tab(3,1); tab(-1,10); ? tab(3,18); "Ready to execute command: "file'name ? tab(4,25); "Current settings:" call display'prompts call display'defaults more'changes: call prompt'for'change if change > 0 & then & goto more'changes quit: ? tab(5,1); tab(-1,10); if give'up = 1 & then & ? tab(10,10); "As you wish, nothing ventured, nothing maimed" :& ? tab(12,25); "Helm out." :& end ? tab(10,10); "Building Submission command"; call assemble'command ? tab(12,1); chain "helm.cmd" end ! ==================== Heavy duty controlling type modules ================= prompt'for'change: choice = 0 call clear'23 input line "which would you like to change? (0 for exit) --> ", choice on choice call kill'it, list'it, susp, revive, halt, try'again, perm, & next'time, minmem, minpri, logname, logtime, when, limit, deadline if choice > 15 & then & call clear'22 :& ? "please enter a number between 1 and 15 " :& call pause :& goto prompt'for'change if choice # 0 & then & set'flag(choice) = 1 :& goto prompt'for'change return assemble'command: ! if a default is indicated, skip the parameter, otherwise, ! build it into the command line. (an additive process at ! each step) The b suffix on the labels is for build. ! Testing open #1, "helm.cmd", output ? #1, ":T" submit'string = "SUBMIT " + file'name call bsusp call brevive call bhalt call btry'again call bperm call bnext'time call bminmem call bminpri call blogname call blogtime call bwhen call blimit call bdeadline ? #1, submit'string ? #1, ":< I sure hope this worked the way you wanted it." ? #1, " have a meaningful day....." ? #1, ">" return ! ================ subroutines that change stuff on the screen =========== kill'it: ! this is a very special case. If they want to kill this file ! we build a command file and execute it immediately!!!! ! Then we come back here. The file we create and chain to is ! called HELM.CMD open #1, "HELM.CMD", output ? #1, ":R" ? #1, "XY = 0" ? #1, "XY 10 1" ? #1, "SUBMIT "file'name"/K" ? #1, ":R" ? #1, "XY 23 1" ? #1, ":" ? #1, ":K" ? #1, "RUN HELM" ? #1, file'name close #1 chain "HELM.CMD" ! note that this is the end. No return statement list'it: ! This works just like the Kill option. We just go out and do ! a submit to see what the story is on this file open #1, "HELM.CMD", output ? #1, ":R" ? #1, "XY = 0" ? #1, "XY 10 1" ? #1, "SUBMIT "file'name"/L" ? #1, "XY 23 1" ? #1, ":" ? #1, ":K" ? #1, "RUN HELM" ? #1, file'name close #1 chain "HELM.CMD" ! note that this is the end. No return statement susp: set'flag(3) = 1 call flip'y'n'display return revive: set'flag(4) = 1 call flip'y'n'display return halt: set'flag(5) = 1 error'choice = "" ? tab(23,1); tab(-1,10); input line "enter NONE, or WARNING, or FATAL, or ALL --> ", error'choice error'choice = ucs(error'choice) if len(error'choice) = 0 & or len(error'choice) > 7 & then & goto halt default(choice) = "Y " + error'choice call display'new'default return try'again: set'flag(6) = 1 call flip'y'n'display return perm: set'flag(7) = 1 call flip'y'n'display return next'time: set'flag(8) = 1 call clear'22 call rel'time'set return minmem: set'flag(9) = 1 call clear'22 ? "Current memory is: " default(choice) ? tab(23,1); input line "What would you like to change it to? (in K's) --> ", default(choice) default(choice) = ucs(default(choice)) x =instr(1,default(choice),"K") if x = 0 & then & default(choice) = default(choice) + "K" call clear'22 call display'new'default return minpri: set'flag(10) = 1 call clear'22 ? "Current priority setting is: "default(choice) input line "What would you like to set it to? --> ", default(choice) call display'new'default call clear'22 call display'new'default return logname: set'flag(11) = 1 call clear'22 ? "Current LOG file name is: " default(choice) input line "What would you like it to be? --> ", default(choice) default(choice) = ucs(default(choice)) x = instr(1,default(choice),".") if x = 0 & then & default(choice) = default(choice) + ".LOG" call display'new'default call clear'22 return logtime: set'flag(12) = 1 call flip'y'n'display return when: set'flag(13) = 1 input'bucket = "" call clear'22 call get'date'and'time ? tab(22,1); "1. set a specific day and time or...2. set a timer for submission later" ? tab(23,1); input line "(1 or 2) --> ", input'bucket if input'bucket < 1 & or input'bucket > 2 & then & call clear'23 :& ? "Please just enter a 1 or a 2 for your choice" :& call pause :& goto when ! abs'or'rel is the sign for absolute or relative time setting ! if it's relative, then we add a "+" to the front of the argument if input'bucket = "1" & then & abs'or'rel = "" & else & abs'or'rel = "+" call clear'22 if input'bucket = 1 & then & call abs'time'set & else & call rel'time'set return limit: set'flag(14)=1 ! would you believe that even though this is a relative time setting ! it doesn't have a + in front of it??!!! We just pretend its absolute abs'or'rel = "" call rel'time'set return deadline: set'flag(15) = 1 call clear'22 input'bucket = "" ? tab(22,1); "1. set a specific day and time or...2. set a time limit" ? tab(23,1); input line "(1 or 2) --> ", input'bucket if input'bucket < 1 & or input'bucket > 2 & then & call clear'23 :& ? "Please just enter a 1 or a 2 for your choice" :& call pause :& goto when ! abs'or'rel is the sign for absolute or relative time setting ! if it's relative, then we add a "+" to the front of the argument if input'bucket = "1" & then & abs'or'rel = "" & else & abs'or'rel = "+" call clear'22 if input'bucket = 1 & then & call abs'time'set & else & call rel'time'set return ! ========== Subroutines used by assemble'command to create submit'string === bsusp: if set'flag(3) = 1 & then & submit'string = submit'string + "/SU" :& ? "."; return brevive: if set'flag(4) = 1 & then & submit'string = submit'string + "/REV" :& ? "."; return bhalt: if set'flag(5) = 1 & then & submit'string = submit'string + "/E:" + error'choice :& ? "."; return btry'again: if set'flag(6) = 1 & then & submit'string = submit'string + "/RES" :& ? "."; return bperm: if set'flag(7) = 1 & then & submit'string = submit'string + "/PE" :& ? "."; return bnext'time: if set'flag(8) = 1 & then & submit'string = submit'string + "/NEXT:" + default(8) :& ? "."; return bminmem: if set'flag(9) = 1 & then & submit'string = submit'string + "/M:" + default(9) :& ? "."; return bminpri: if set'flag(10) = 1 & then & submit'string = submit'string + "/PR:" + default(10) :& ? "."; return blogname: if set'flag(11) = 1 & then & submit'string = submit'string + "/O:" + default(11) :& ? "."; return blogtime: if set'flag(12) = 1 & then & submit'string = submit'string + "/LO" :& ? "."; return bwhen: submit'string = submit'string + "/A:" + default(13) ? "."; return blimit: if set'flag(14) = 1 & then & submit'string = submit'string + "/LIM:" + default(14) :& ?"."; return bdeadline: if set'flag(15) = 1 & then & submit'string = submit'string + "/D:" + default(15) :& ?"."; return ! =================== Miscelleaneous Subroutines & Data ==================== enter'file'name: input'bucket = "" : file'name = "" ? tab(22,10); "the default for the file name is .CTL" ? tab(23,10); "Just hit a RETURN if you want to quit" ? tab(10,10); tab(-1,9); input line "enter the file name --> ", input'bucket ! set x = 0 if there's a . in the name ! if len(input'bucket) is 0 set defaults, skip the rest ! check for total length <= 10 ! check for file'name length <= 6 ! check for no extension & set to default'extension goto finished ! ! shift to uppercase x = 0 x = instr(1,input'bucket,".") if len(input'bucket) = 0 & and len(default'file'name) = 0 & then & give'up = 1 :& goto finished'editing if len(input'bucket) = 0 & then & file'name = default'file'name + "." + default'extension :& goto finished'editing if len(input'bucket) > 10 & or len(input'bucket[1,x-1]) > 6 & then & call file'too'long :& goto enter'file'name if x = 0 & then & file'name = input'bucket + "." + default'extension :& goto finished'editing file'name = input'bucket finished'editing: file'name = ucs(file'name) return lookup'file: x = 0 lookup file'name, x if x <= 0 & then & call no'such'file return file'too'long: ! you may want to do your own curser positioning for this message call clear'23 input line "that's too long for a file name. Try again --> ", dummy call clear'23 return no'such'file: call clear'23 input line "Sorry, but no file by that name exists. Try again --> ", dummy call clear'23 return load'prompts'and'defaults: for n = 1 to 15 read prompt(n) read default(n) next n return display'prompts: for n = 1 to 15 ? tab(n+5,7); n; ? tab(n+5,10); prompt(n) next n return display'defaults: ! default #11 is wierd, we have to create it ! all of the others use the standard default prompts for n = 1 to 15 ? tab(n+5,50); default(n) next n x = instr(1,file'name,".") default(11) = file'name[1,x-1] + ".LOG" ? tab(16,50); default(11) return get'date'and'time: choice = 13 ampm = "AM" todays'date = date time'is'now = time hours = int(time'is'now/3600) minutes = int(time'is'now/60) - (hours * 60) chop'off'another'day: if hours > 24 & then & hours = hours - 24 :& goto chop'off'another'day if hours > 12 & then & hours = hours - 12 :& ampm = "PM" if hours = 12 & then & ampm = "PM" month'string = month day'string = day year'string = day call date'line return abs'time'set: call clear'22 ? tab(22,10); "Enter the date and time for execution:" & abs'month'again: ? tab(23,1); tab(-1,9); "Month: "; input "", month'string if val(month'string) > 12 or val(month'string) < 1 & then & call clear'23 :& ? "Gimmie a break, there's no month number "month'string; :& input line "! Hit RETURN to try again --> " dummy :& month'string = "" :& goto abs'month'again month'string = month'string using Z ? tab(23,8); tab(-1,9); month'string; ? tab(23,12); "Day: "; input "", day'string day'string = day'string using Z ? tab(23,17) day'string abs'year'again: ? tab(23,20); "Year: "; input "" year'string if val(year'string) > 100 & then & ? tab(23,20); "just the last two digits will be enough" :& input line " Hit RETURN to try this one again --> ", dummy :& year'string = "" :& goto abs'year'again year'string = year'string using Z ? tab(23,1); tab(-1,9); "Hour: "; input "", hours hours = hours using Z ? tab(23,7); hours ? tab(23,10); "Minutes: "; input "", minutes minutes = minutes using Z ? tab(23,19); minutes ? tab(23,22); input "AM or PM: ",ampm ampm = ucs(ampm) default(choice) = & month'string + "-" + day'string + "-" + year'string & + "," + hours + ":" + minutes + " " + ampm call date'line call display'new'default call clear'22 return rel'time'set: call clear'22 ? tab(22,10); "Set the timer for delayed execution" ? tab(23,1); tab(-1,9); "Month: "; input "", month'string month'string = month'string using Z ? tab(23,8); tab(-1,9); month'string; ? tab(23,12); "Day: "; input "", day'string day'string = day'string using Z ? tab(23,17); day'string; ? tab(23,20); "Year: "; input "" year'string year'string = year'string using Z ? tab(23,1); tab(-1,9); "Hour: "; input "", hours ? tab(23,10); "Minutes: "; input "", minutes default(choice) = & "+" + month'string + "-" + day'string + "-" + year'string & + "," + hours using Z + ":" + minutes using Z call date'line x = instr(1,default(choice),"M") default(choice) = default(choice)[1,x-2] call display'new'default call clear'22 return date'line: default(choice) = abs'or'rel + (month'string using Z) + "-" + & (day'string using Z) + "-" + (year'string using Z) + & "," + (hours using "#Z") + ":" + (minutes using "#Z") + " " + & ampm return display'new'default: ? tab(choice+5,50); tab(-1,9); default(choice) return clear'22: ? tab(22,1); tab(-1,10); return clear'23: ? tab(23,1); tab(-1,10); return flip'y'n'display: if default(choice) = "Y" & then & default(choice) = "N" & else & default(choice) = "Y" call display'new'default return pause: ? tab(23,1); tab(-1,10); input line "hit Return to continue --> ", dummy ? tab(23,1); tab(-1,10); return ! ============================== the prompt screen =========================== data . Kill this file? ..................... , N data . List the status of this file? ....... , N data . Suspend this file? .................. , N data . Revive this file? ................... , N data . Give up if errors occur? ............ , N data . Try again if the system crashes? .... , N data . Enter as a permanent command? ....... , N data . If permanent - set next time to run . , no time set data . Minimum memory needed: .............. , 32K data . Set Priority: ....................... , 256 data . Change the name of the LOG file: .... , .LOG data . Timestamp each line in the .LOG file? , N data . Set to execute at: .................. , now data . Set a limit on how long this can run. , no limit data . Set a deadline date for execution: .. , no deadline