Compare commits

..

No commits in common. "881892eb39530055ac78134769c749a04ec279e6" and "97c342693c110213a602abfa75191731d3b2b29a" have entirely different histories.

4 changed files with 16 additions and 152 deletions

View File

@ -66,8 +66,6 @@ jobs:
echo "=== Debug: File detection complete ===" echo "=== Debug: File detection complete ==="
- name: Upload to PDS and Submit JCL - name: Upload to PDS and Submit JCL
env:
MVS_BATCH_PASSWORD: ${{ vars.MVS_BATCH_PASSWORD }}
if: steps.files.outputs.file != '' if: steps.files.outputs.file != ''
run: | run: |
echo "=== Debug: Starting upload/submit ===" echo "=== Debug: Starting upload/submit ==="

View File

@ -16,11 +16,14 @@ MVSHOST = "oldcomputernerd.com"
RDRPORT = 3505 RDRPORT = 3505
MVS_PASSWORD = os.environ.get("MVS_BATCH_PASSWORD") MVS_PASSWORD = os.environ.get("MVS_BATCH_PASSWORD")
def upload_source(local_file, dataset_name, member_name, mvshost=MVSHOST):
"""Upload source code to MVS PDS member"""
def create_jcl_payload(local_file, dataset_name, member_name): # Read the source file
# full path will come from the job runner
# filepath = os.path.join(SRCLIB, local_file)
with open(local_file, 'r') as f: with open(local_file, 'r') as f:
sysin = f.readlines() source_lines = f.readlines()
# PDS member: Use IEBUPDTE # PDS member: Use IEBUPDTE
jcl = f""" jcl = f"""
@ -36,48 +39,31 @@ def create_jcl_payload(local_file, dataset_name, member_name):
""" """
# Append control statement, source lines, end, and terminator (no leading space on ./) # Append control statement, source lines, end, and terminator (no leading space on ./)
jcl += f"./ ADD NAME={member_name}\n" jcl += f"./ ADD NAME={member_name}\n"
for line in sysin: for line in source_lines:
line = line.rstrip('\n')[:80] line = line.rstrip('\n')[:80]
jcl += line.ljust(80) + "\n" jcl += line.ljust(80) + "\n"
jcl += "./ ENDUP\n" jcl += "./ ENDUP\n"
jcl += "/*\n" jcl += "/*\n"
return jcl
def upload_source(local_file, dataset_name, member_name, mvshost=MVSHOST):
"""Upload source code to MVS PDS member"""
# Read the source file
# full path will come from the job runner
# filepath = os.path.join(SRCLIB, local_file)
payload = create_jcl_payload(local_file, dataset_name, member_name)
# Write JCL to temporary file and submit via netcat # Write JCL to temporary file and submit via netcat
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.jcl') as tmpfile: with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.jcl') as tmpfile:
tmpfile.write(payload) tmpfile.write(jcl)
tmpfile.flush()
tmpfile_path = tmpfile.name tmpfile_path = tmpfile.name
try: try:
with open(tmpfile_path, 'rb') as f: # Use cat to read the file and pipe to netcat
subprocess.run( # cmd = f"cat {tmpfile_path} | nc -w3 {mvshost} {RDRPORT}"
['nc', '-w', '5', mvshost, str(RDRPORT)], cmd = f"nc -w 5 {mvshost} {RDRPORT} < {tmpfile_path}"
input=f.read(), print(cmd)
check=True, subprocess.run(cmd, shell=True, check=True)
capture_output=True
)
print(f"Uploaded {local_file} to {dataset_name}({member_name})") print(f"Uploaded {local_file} to {dataset_name}({member_name})")
return 0 return 0
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(f"Upload failed: {e}") print(f"Upload failed: {e}")
print("stderr:", e.stderr.decode(errors='ignore'))
return 1 return 1
finally: finally:
# Clean up outside # Clean up temp file
#os.unlink(tmpfile_path) os.unlink(tmpfile_path)
print(f"Would have deleted {tmpfile_path}")
def submit_jcl(job, mvshost="oldcomputernerd.com"): def submit_jcl(job, mvshost="oldcomputernerd.com"):
"""Submit JCL job from local directory""" """Submit JCL job from local directory"""

View File

@ -1,60 +0,0 @@
//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=@05054.SRCLIB.C,DISP=MOD,UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD *
./ ADD NAME=SIEVE08
#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;
}
./ ENDUP
/*

View File

@ -1,60 +0,0 @@
//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=@05054.SRCLIB.C,DISP=MOD,UNIT=SYSDA,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD *
./ ADD NAME=SIEVE08
#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;
}
./ ENDUP
/*