/* -- IOF Rexx exec to RELEASE or CANCEL HELD INPUT jobs -------------*/ /* Parse input parm to get jobname or "RETURNCODE" */ parse arg Function Job_Name TestParm if TestParm = 'TEST' then trace 'R' /* If parm is "RETURNCODE" then exit with the return code */ /* This is a trick to get the return code back to the batch job */ if Function = 'RETURNCODE' then exit Job_Name /* Job_name parm is return code */ /* Check the environment. If not in the IOF environment then PUSH */ /* the IOF command to select HELD INPUT jobs matching the specified */ /* jobname. Only select jobs that were submitted (owned) by the */ /* current user. Exit this exec and re-enter in IOF environment. */ parse source . . MyName . . . . . env . if env <> 'IOF' then do push 'IOF' Job_Name, 'INPUT SELECT(HELD) SCOPE(ME) JOBLIST.%'MyName Function Job_Name exit end /* Analyze the requested Function */ Select When Function = 'CANCEL' then Action = 'Canceling' When Function = 'RELEASE' then do Function = 'A' /* Change function to IOF Release line cmd */ Action = 'Releasing' end Otherwise do Action = 'Found' Function = 'FIND' end end address IOF /* How many jobs were found. Variable ROWS will contain the number */ /* of rows on the screen, which is the number of jobs found */ 'TSICOPY NAME(ROWS) TO(REXX) SECTION(PANEL)' /* EXTEND the display so that extended fields are accessable */ 'EXTEND' /* If no jobs were found, give error message */ if rows = 0 then say Job_Name 'is not a held input job,' Function 'not done' /* Issue a message for each found job, then CANCEL or RELEASE */ else do menu_nbr = 1 to rows /* Retrieve the jobname, jobid, etc for job with "menu_nbr" */ menu_nbr 'TSICOPY NAME(JOBNAME JOBID OWNER USERNAME RAN) TO(REXX)' /* Format CANCELING or RELEASING message and issue it */ jobname = strip(jobname) owner = strip(owner) username= strip(username) say Action 'job' jobname'('jobid') submitted by' owner, username 'at' ran /* CANCEL or RELEASE the current job at row "menu_number" */ if Function \= 'FIND' then do menu_nbr Function /* Check return code of the RELEASE or CANCEL. If non-zero then */ /* issue the IOF error message and force return code 4 on exit */ if rc \= 0 then do 'TSICOPY NAME(MESSAGE) TO(REXX) SECTION(PANEL)' say '*** Error ***' message rows = 0 end end end /* Exit from IOF */ 'JUMP X' /* Set the return code: 0 - jobname found 4 - not found */ if rows = 0 then retcod = 4 else retcod = 0 /* Re-invoke the exec to give the return code to the batch job */ push '%'MyName 'RETURNCODE' retcod 'JUMP X' exit