try job submission yet again

This commit is contained in:
Gregory Gauthier 2026-02-06 17:15:44 +00:00
parent 91c70b17cf
commit b7a3eb522e

View File

@ -122,19 +122,27 @@ def submit_jcl(job, mvshost="oldcomputernerd.com"):
try: try:
# Read the JCL file and send via netcat (same approach as upload_source) # Read the JCL file and send via netcat (same approach as upload_source)
with open(subjcl, 'rb') as f: with open(subjcl, 'rb') as f:
jcl_data = f.read()
print(f"Submitting {len(jcl_data)} bytes of JCL to {mvshost}:{RDRPORT}")
result = subprocess.run( result = subprocess.run(
['nc', '-w', '5', mvshost, str(RDRPORT)], ['nc', '-w', '5', mvshost, str(RDRPORT)],
input=f.read(), input=jcl_data,
check=True, check=True,
capture_output=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())
if result.stderr:
print("netcat stderr:", result.stderr.decode(errors='ignore').strip())
if result.returncode != 0:
print(f"WARNING: netcat returned non-zero exit code: {result.returncode}")
return 1
return 0 return 0
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(f"JCL submission failed: {e}") print(f"ERROR: JCL submission failed with exit code {e.returncode}")
print("stderr:", e.stderr.decode(errors='ignore')) print("stderr:", e.stderr.decode(errors='ignore'))
print("stdout:", e.stdout.decode(errors='ignore'))
return 1 return 1
except FileNotFoundError as e: except FileNotFoundError as e:
print(f"Error reading JCL file: {e}") print(f"Error reading JCL file: {e}")