strip c comments entirely on upload to reader

This commit is contained in:
Gregory Gauthier 2026-02-06 10:54:45 +00:00
parent 578a721baf
commit d926f2e1fb

View File

@ -37,8 +37,12 @@ def create_jcl_payload(local_file, dataset_name, member_name):
# Append control statement, source lines, end, and terminator (no leading space on ./)
jcl += f"./ ADD NAME={member_name}\n"
for line in sysin:
line = line.rstrip('\n')[:80]
jcl += line.ljust(80) + "\n"
line = line.rstrip('\n')
stripped = line.lstrip()
# Skip comment lines that would be interpreted as JCL
if stripped.startswith('//') or stripped.startswith('/*'):
continue
jcl += line[:80].ljust(80) + "\n"
jcl += "./ ENDUP\n"
jcl += "/*\n"
@ -54,7 +58,6 @@ def upload_source(local_file, dataset_name, member_name, mvshost=MVSHOST):
payload = create_jcl_payload(local_file, dataset_name, member_name)
# Write JCL to temporary file and submit via netcat
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.jcl') as tmpfile:
tmpfile.write(payload)
tmpfile.flush()