/* rexx */ /*-------------------------------------------------------------------*/ /* */ /* REXX Exec : RUNNING */ /* */ /* Description : Checks to see if a task is running */ /* */ /* Created on : 1 Aug 2020 */ /* Created by : Kevin Ferguson */ /* : Userid(MIT001) */ /* : using ABBYDALE.PROD.REXX(RUNNING) */ /* */ /* Called by : */ /* */ /* Calls : */ /* */ /* Change Activity : */ /* */ /* MM/DD/YYYY ID Comment */ /* --------------------------------------------------------------- */ /* 10/17/2021 MSG Added ability to supress messages */ /* */ /* ©Copyright of Abbydale Systems LLC. */ /* */ /*-------------------------------------------------------------------*/ pee = '' signal on novalue /* un-initialized vars */ signal on halt /* attention key */ parse upper arg taskname msg /*MSG*/ if taskname = "" then do msg = "x" /*MSG*/ do while taskname = "" say 'Enter task name to check. (use to terminate)' parse upper pull taskname if taskname = '' then exit(12) if length(taskname) > 8 then do task = "" Say 'Invalid task name. Length > 8. Re-Enter' end end end if taskname = "?" then do Call disp_help exit(4) end if length(taskname) > 8 then do say 'Invalid task name length (>8).' exit(12) end asidn = 1 cvt = storage(10,4) /* cvt address in memory */ asvt = storage(d2x(556+c2d(cvt)),4) /* adress of ASVT */ ascb1 = storage(d2x(528+c2d(asvt)),4) /* ASCB of *MASTER* */ acro = storage(d2x(512+c2d(asvt)),4) /* acronym of "ASVT" */ maxu = storage(d2x(516+c2d(asvt)),4) /* asvtmaxu */ rc = 8 max = c2d(maxu) if acro \= 'ASVT' then do say '** Addressing error, ASVT not working' exit (8) end do forever job = getjbn(asidn) if job = taskname then do if msg <> "" then do /*MSG*/ say job 'is running' end /*MSG*/ rc = 0 leave end if job=0 then leave end if rc = 8 then do /*MSG*/ if msg <> "" then do /*MSG*/ say taskname 'is not running' /*MSG*/ end /*MSG*/ end /*MSG*/ exit(rc) getjbn: procedure expose asidn , cvt asvt max opt ascb1 task if asidn > max then return 0 /* end of jobs? */ offset = 4*asidn-4 asvten = d2x(offset+528+c2d(asvt)) ascb = storage(d2x(offset+528+c2d(asvt)),4) asidn = asidn + 1 /* non-reusable ASCB */ if substr(c2x(ascb),1,1) = '8' then do /* non-free ascb */ if substr(c2x(ascb),2,7) = substr(c2x(ascb1),2,7) then do end return '' end if substr(c2x(ascb),2,7) = '0000000' then do say ' ** Error the ASCB ''asvt, is zero' asvten , ' asid' asidn-1 '(dec)' end ascbjbni = storage(d2x(172+c2d(ascb)),4) ascbjbns = storage(d2x(176+c2d(ascb)),4) jobname = 'STARTING' if c2x(ascbjbns) \= 0 then do jobname = storage(c2x(ascbjbns),8) tsb = storage(d2x(60+c2d(ascb)),4) if c2x(tsb) \= 0 then do typ = 'tsu' end end if c2x(ascbjbni) \= 0 then do jobname = storage(c2x(ascbjbni),8) end return jobname /*-------------------------------------------------------------------*/ /* disp_help procedure */ /*-------------------------------------------------------------------*/ disp_help: procedure pgm_name=sysvar("sysicmd") if pgm_name="" then pgm_name="RUNNING" say left(pgm_name,8) "- a REXX exec that will check to see if a named" say "task is executing." say "" say "Usage: running taskname showmsg | ? " /*MSG*/ say "" say " taskname - Name of the task to be checked for." say " showmsg - Show the messages." /*MSG*/ say " ? - generates this information." say "" say " Return Codes : 0 - Task is runnung" say " 4 - Help displyed" say " 8 - Task is not running" say " 12 - Invalid taskname entered" Say " 16 - Critical error" return /*-------------------------------------------------------------------*/ /* trap NOVALUE condition */ /*-------------------------------------------------------------------*/ novalue: say 'NOVALUE entered from line' sigl say condition("D") say 'The instruction is suppressed' address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* trap HALT condition */ /*-------------------------------------------------------------------*/ halt: say 'HALT acknowledged in line' sigl say 'Cleanup processing in progress' address "TSO" "delstack" exit(16) /*-------------------------------------------------------------------*/ /* End of RUNNING */ /*-------------------------------------------------------------------*/