config updates
Some checks failed
MVS Upload & Execute / upload-and-run (push) Failing after 5s

This commit is contained in:
Greg Gauthier 2025-10-19 13:48:47 +01:00
parent a93d97c68a
commit dcf82c0b71
4 changed files with 163 additions and 0 deletions

94
mvs_job.py Executable file
View File

@ -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 <local_source_file> <dataset> <member> <job_name> [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)

7
poetry.lock generated Normal file
View File

@ -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"

16
pyproject.toml Normal file
View File

@ -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"

46
src/SIEVE01.c Normal file
View File

@ -0,0 +1,46 @@
#include<stdio.h>
#define LIMIT 10000
#define PRIMES 1000
int main()
{
int i,j,numbers[LIMIT];
int primes[PRIMES];
for (i=0;i<LIMIT;i++)
{
numbers[i]=i+2;
}
for (i=0;i<LIMIT;i++)
{
if (numbers[i]!=-1)
{
for (j=2*numbers[i]-2;j<LIMIT;j+=numbers[i])
numbers[j]=-1;
}
}
j = 0;
for (i=0;i<LIMIT&&j<PRIMES;i++)
if (numbers[i]!=-1)
primes[j++] = numbers[i];
printf("\n");
printf("PRIME NUMBERS BETWEEN 1 AND %d\n",LIMIT);
printf("TOTAL PRIMES FOUND: %d\n\n",PRIMES);
printf("LIST OF PRIMES:\n\n");
for (i=0;i<PRIMES;i++)
if (i % 20 == 0)
{
printf("\n %4d ",primes[i]);
}
else
{
printf("%4d ",primes[i]);
}
return 0;
}