try job submission yet again
Some checks failed
MVS Delete Members / delete-members (push) Failing after 13s
MVS Submit & Execute / upload-and-run (push) Failing after 14s

This commit is contained in:
Gregory Gauthier 2026-02-06 17:33:37 +00:00
parent d16ae2178c
commit d7f329d49f
3 changed files with 34 additions and 11 deletions

View File

@ -1,5 +1,5 @@
//GMG0001 JOB (GCC),'C Program',
// NOTIFY=@05054,CLASS=A,MSGCLASS=H,
// NOTIFY=@05054,CLASS=A,MSGCLASS=A,
// MSGLEVEL=(1,1),REGION=4M,TIME=1440
//STEP1 EXEC GCCCG,INFILE='@05054.SRCLIB.C(GMG0001)'
//

View File

@ -1,5 +1,5 @@
//{NAME} JOB (GCC),'C Program',
// NOTIFY=@05054,CLASS=A,MSGCLASS=H,
// NOTIFY=@05054,CLASS=A,MSGCLASS=A,
// MSGLEVEL=(1,1),REGION=4M,TIME=1440
//STEP1 EXEC GCCCG,INFILE='@05054.SRCLIB.C({NAME})'
//

View File

@ -37,11 +37,17 @@ def find_job_number(syslog, jobname):
return match.group(1)
return None
def check_job_completed(syslog, jobname, job_number):
"""Check if a job has completed printing (HASP150 message)"""
# Pattern: /12.28.03 JOB 257 $HASP150 SIMPLE2 ON PRINTER1
pattern = rf'/\d+\.\d+\.\d+\s+JOB\s+{job_number}\s+\$HASP150\s+{jobname}\s+ON\s+PRINTER'
return re.search(pattern, syslog, re.IGNORECASE) is not None
def check_job_ended(syslog, jobname, job_number):
"""Check if a job has ended (HASP395 ENDED)"""
# Pattern for job ended: /18.24.41 JOB 276 $HASP395 GMG0001 ENDED
ended_pattern = rf'/\d+\.\d+\.\d+\s+JOB\s+{job_number}\s+\$HASP395\s+{jobname}\s+ENDED'
return re.search(ended_pattern, syslog, re.IGNORECASE) is not None
def check_job_printed(syslog, jobname, job_number):
"""Check if a job has printed output (HASP150)"""
# Pattern for job printed: /12.28.03 JOB 257 $HASP150 SIMPLE2 ON PRINTER1
printed_pattern = rf'/\d+\.\d+\.\d+\s+JOB\s+{job_number}\s+\$HASP150\s+{jobname}\s+ON\s+PRINTER'
return re.search(printed_pattern, syslog, re.IGNORECASE) is not None
def list_pdfs_local(local_dir):
"""List PDF files in a local directory (for mounted volumes)"""
@ -136,22 +142,39 @@ def poll_for_job(jn, to=300, poll_interval=5):
return 1
# Phase 2: Wait for completion
print(f"Phase 2: Waiting for job completion ($HASP150)...")
print(f"Phase 2: Waiting for job completion ($HASP395 ENDED)...")
job_ended = False
job_printed = False
while time.time() - start_time < to:
syslog = get_syslog()
if not syslog:
time.sleep(poll_interval)
continue
if check_job_completed(syslog, jobname_upper, job_number):
print(f"Job J{job_number} completed and printed!")
job_ended = check_job_ended(syslog, jobname_upper, job_number)
job_printed = check_job_printed(syslog, jobname_upper, job_number)
if job_ended:
print(f"Job J{job_number} has ended")
break
time.sleep(poll_interval)
else:
if not job_ended:
print(f"Timeout: Job J{job_number} did not complete after {to}s")
return 1
# Check if output was printed (required for PDF retrieval)
if not job_printed:
print(f"ERROR: Job J{job_number} completed but no output was printed ($HASP150 not found)")
print(f"This usually means MSGCLASS=H (hold) was used in the JCL")
print(f"Check TSO SDSF or console for job output manually")
print(f"To fix: Change JCL to use MSGCLASS=A for automatic printing")
return 1
print(f"Job J{job_number} completed and output printed!")
# Phase 3: Retrieve PDF
print("Phase 3: Retrieving PDF...")
# Give the PDF a moment to be written to disk