Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job submission #1

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion .github/scripts/mainframe_operations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,46 @@ run_cobolcheck() {

# Copy the JCL file if it exists
if [ -f "${program}.JCL" ]; then
if cp ${program}.JCL "//'${ZOWE_USERNAME}.JCL($program)'"; then
if cp ${program}.JCL "//'Z36963.JCL($program)'"; then
echo "Copied ${program}.JCL to ${ZOWE_USERNAME}.JCL($program)"
else
echo "Failed to copy ${program}.JCL to ${ZOWE_USERNAME}.JCL($program)"
fi
else
echo "${program}.JCL not found"
fi
# Submit job
if [ -f "${program}.JCL" ]; then
echo "Submitting job for $program"
job_id=$(zowe jobs submit data-set "Z36963.JCL($program)" --rff jobid --rft string)
if [ $? -eq 0 ]; then
echo "Job submitted successfully. Job ID: $job_id"

# Check job status
echo "Checking job status..."
for i in {1..10}; do # Try 10 times, waiting 5 seconds between each attempt
status=$(zowe jobs view job-status-by-jobid "$job_id" --rff status --rft string)
echo "Current status: $status"
if [[ "$status" == "OUTPUT" ]]; then
echo "Job completed. Fetching output..."
zowe jobs view sfbi "$job_id" 2
break
elif [[ "$status" == "ABEND" || "$status" == "CANCELED" ]]; then
echo "Job failed with status: $status"
break
fi
sleep 5
done

if [[ "$status" != "OUTPUT" && "$status" != "ABEND" && "$status" != "CANCELED" ]]; then
echo "Job did not complete within the expected time. Last known status: $status"
fi
else
echo "Failed to submit job for $program"
fi
else
echo "JCL file for $program not found. Job not submitted."
fi
}

# Run for each program
Expand Down
Loading