submit batch job fix
This commit is contained in:
parent
bb6c652463
commit
359120f31b
@ -91,16 +91,25 @@ def submit_jcl(job, mvshost="oldcomputernerd.com"):
|
|||||||
print(f"JCL file {subjcl} not found")
|
print(f"JCL file {subjcl} not found")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
subcmd = f"nc -w 5 {mvshost} {RDRPORT} < {subjcl}"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(subcmd, shell=True, check=True, capture_output=True)
|
# Read the JCL file and send via netcat (same approach as upload_source)
|
||||||
|
with open(subjcl, 'rb') as f:
|
||||||
|
result = subprocess.run(
|
||||||
|
['nc', '-w', '5', mvshost, str(RDRPORT)],
|
||||||
|
input=f.read(),
|
||||||
|
check=True,
|
||||||
|
capture_output=True
|
||||||
|
)
|
||||||
print(f"Submitted JCL job: {job}")
|
print(f"Submitted JCL job: {job}")
|
||||||
if result.stdout:
|
if result.stdout:
|
||||||
print("JES response:", result.stdout.decode(errors='ignore').strip())
|
print("JES response:", result.stdout.decode(errors='ignore').strip())
|
||||||
return 0
|
return 0
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"JCL submission failed: {e}")
|
print(f"JCL submission failed: {e}")
|
||||||
|
print("stderr:", e.stderr.decode(errors='ignore'))
|
||||||
|
return 1
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
print(f"Error reading JCL file: {e}")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user