From dcf82c0b71db227512f574e042bc510b6328fa0e Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sun, 19 Oct 2025 13:48:47 +0100 Subject: [PATCH] config updates --- mvs_job.py | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ poetry.lock | 7 ++++ pyproject.toml | 16 +++++++++ src/SIEVE01.c | 46 ++++++++++++++++++++++++ 4 files changed, 163 insertions(+) create mode 100755 mvs_job.py create mode 100644 poetry.lock create mode 100644 pyproject.toml create mode 100644 src/SIEVE01.c diff --git a/mvs_job.py b/mvs_job.py new file mode 100755 index 0000000..e99fd3c --- /dev/null +++ b/mvs_job.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 + +import sys +import subprocess +import tempfile +import os + + +SRCLIB = "src/" +JCLLIB = "jcl/" +MVSHOST = "oldcomputernerd.com" +RDRPORT = 3505 + +def upload_source(local_file, dataset_name, member_name, mvshost=MVSHOST): + """Upload source code to MVS PDS member""" + + # Read the source file + filepath = os.path.join(SRCLIB, local_file) + with open(filepath, 'r') as f: + source_lines = f.readlines() + + # PDS member: Use IEBUPDTE + jcl = f""" +//UPLOAD JOB (ACCT),'UPLOAD', +// USER=@05054,PASSWORD=PASSWD, +// CLASS=A,MSGCLASS=H,NOTIFY=@05054 +//COPY EXEC PGM=IEBUPDTE,PARM=NEW +//SYSPRINT DD SYSOUT=* +//SYSUT1 DD DUMMY +//SYSUT2 DD DSN={dataset_name},DISP=MOD,UNIT=SYSDA, +// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0) +//SYSIN DD * +""" + # Append control statement, source lines, end, and terminator (no leading space on ./) + jcl += f"./ ADD NAME={member_name}\n" + for line in source_lines: + line = line.rstrip('\n')[:80] + jcl += line.ljust(80) + "\n" + jcl += "./ ENDUP\n" + jcl += "/*\n" + + # Write JCL to temporary file and submit via netcat + with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.jcl') as tmpfile: + tmpfile.write(jcl) + tmpfile_path = tmpfile.name + + try: + # Use cat to read the file and pipe to netcat + cmd = f"cat {tmpfile_path} | nc -w1 {mvshost} {RDRPORT}" + subprocess.run(cmd, shell=True, check=True) + print(f"Uploaded {local_file} to {dataset_name}({member_name})") + return 0 + except subprocess.CalledProcessError as e: + print(f"Upload failed: {e}") + return 1 + finally: + # Clean up temp file + os.unlink(tmpfile_path) + +def submit_jcl(job, mvshost="oldcomputernerd.com"): + """Submit JCL job from local directory""" + subjcl = os.path.join(JCLLIB, f"{job}.jcl") + + if not os.path.exists(subjcl): + print(f"JCL file {subjcl} not found") + return 1 + + subcmd = f"cat {subjcl} | nc -w1 {mvshost} {RDRPORT}" + + try: + subprocess.run(subcmd, shell=True, check=True) + print(f"Submitted JCL job: {job}") + return 0 + except subprocess.CalledProcessError as e: + print(f"JCL submission failed: {e}") + return 1 + +if __name__ == "__main__": + if len(sys.argv) < 5: + print("Usage: mvs_job.py [mvshost]") + sys.exit(1) + + local_file = sys.argv[1] + dataset_name = sys.argv[2] + member_name = sys.argv[3] + job = sys.argv[4] + mvshost = sys.argv[5] if len(sys.argv) > 5 else MVSHOST + + # Step 1: Upload source to PDS + if upload_source(local_file, dataset_name, member_name, mvshost) != 0: + sys.exit(1) + + # Step 2: Submit JCL job + submit_jcl(job, mvshost) \ No newline at end of file diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..8d6a570 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. +package = [] + +[metadata] +lock-version = "2.1" +python-versions = ">=3.12" +content-hash = "75265641fd1a3f2a4d608312a3879427b7141ac2a51d0873da5711cbc8ead28e" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1d0c5ef --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[project] +name = "tk5-c90-projects" +version = "0.1.0" +description = "" +authors = [ + {name = "Greg Gauthier",email = "gmgauthier@protonmail.com"} +] +readme = "README.md" +requires-python = ">=3.12" +dependencies = [ +] + + +[build-system] +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/src/SIEVE01.c b/src/SIEVE01.c new file mode 100644 index 0000000..f17c422 --- /dev/null +++ b/src/SIEVE01.c @@ -0,0 +1,46 @@ +#include + +#define LIMIT 10000 +#define PRIMES 1000 + +int main() +{ + int i,j,numbers[LIMIT]; + int primes[PRIMES]; + + for (i=0;i