Skip to content

Commit

Permalink
Fixes for job submission and update of stc jcl
Browse files Browse the repository at this point in the history
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
  • Loading branch information
1000TurquoisePogs committed Jan 31, 2024
1 parent ebb9f72 commit f4bdf39
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 10 deletions.
13 changes: 9 additions & 4 deletions bin/commands/init/generate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,31 @@ export function execute(dryRun?: boolean) {
common.requireZoweYaml();
const ZOWE_CONFIG=config.getZoweConfig();
const tempFile = fs.createTmpFile();
zosFs.copyMvsToUss(ZOWE_CONFIG.zowe.setup.dataset.prefix + 'SZWESAMP(ZWEGENER)', tempFile);
zosFs.copyMvsToUss(ZOWE_CONFIG.zowe.setup.dataset.prefix + '.SZWESAMP(ZWEGENER)', tempFile);
let jclContents = xplatform.loadFileUTF8(tempFile, xplatform.AUTO_DETECT);

jclContents = jclContents.replace("DSN={zowe.setup.dataset.prefix}", "DSN="+ZOWE_CONFIG.zowe.setup.dataset.prefix);
jclContents = jclContents.replace("{zowe.setup.dataset.loadlib}", ZOWE_CONFIG.zowe.setup.dataset.loadlib);
jclContents = jclContents.replace(/\{zowe\.runtimeDirectory\}/gi, ZOWE_CONFIG.zowe.runtimeDirectory);
jclContents = jclContents.replace('FILE <full path to zowe.yaml file>', 'FILE '+ZOWE_CONFIG.zowe.workspaceDirectory+'/.env/.zowe-merged.yaml');
os.remove(tempFile);

xplatform.storeFileUTF8(tempFile, xplatform.AUTO_DETECT, jclContents);

common.printMessage(`Template JCL: ${ZOWE_CONFIG.zowe.setup.dataset.prefix + 'SZWESAMP(ZWEGENER)'}`);
common.printMessage(`Template JCL: ${ZOWE_CONFIG.zowe.setup.dataset.prefix + '.SZWESAMP(ZWEGENER)'}`);
common.printMessage('JCL content:');
common.printMessage(jclContents);

if (dryRun) {
common.printMessage('JCL not submitted, command run with dry run flag.');
common.printMessage('To perform command, re-run command without dry run flag, or submit the JCL directly.');
os.remove(tempFile);

} else { //TODO can we generate just for one step, or no reason?
common.printMessage('Submitting Job ZWEGENER');
const jobid = zosJes.submitJob(jclContents);
const jobid = zosJes.submitJob(tempFile);
const result = zosJes.waitForJob(jobid);
os.remove(tempFile);

common.printMessage(`Job completed with RC=${result.rc}`);
if (result.rc == 0) {
common.printMessage("Zowe JCL generated successfully");
Expand Down
4 changes: 3 additions & 1 deletion bin/commands/init/mvs/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ else
if [ -z "${ZWE_CLI_PARAMETER_DRY_RUN}" ]; then
print_message "Submitting Job ZWEIMVS"
jobid=$(submit_job "$jcl_contents")
jobid=$(submit_job $jcl_file)
code=$?
if [ ${code} -ne 0 ]; then
print_error_and_exit "Error ZWEL0161E: Failed to run JCL ${jcllib_location}(ZWEIMVS)." "" 161
Expand All @@ -96,6 +96,7 @@ else
jobstate=$(wait_for_job "${jobid}")
code=$?
rm $jcl_file
if [ ${code} -eq 1 ]; then
print_error_and_exit "Error ZWEL0162E: Failed to find job ${jobid} result." "" 162
fi
Expand All @@ -112,6 +113,7 @@ else
print_message "JCL not submitted, command run with dry run flag."
print_message "To perform command, re-run command without dry run flag, or submit the JCL directly"
print_level2_message "Zowe custom data sets are initialized successfully."
rm $jcl_file
fi
fi
Expand Down
4 changes: 3 additions & 1 deletion bin/commands/init/vsam/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ print_message "$jcl_contents"

if [ -z "${ZWE_CLI_PARAMETER_DRY_RUN}" ]; then
print_message "Submitting Job ZWECSVSM"
jobid=$(submit_job "$jcl_contents")
jobid=$(submit_job $jcl_file)
code=$?
if [ ${code} -ne 0 ]; then
print_error_and_exit "Error ZWEL0161E: Failed to run JCL ${jcllib}(ZWECSVSM)." "" 161
Expand All @@ -108,6 +108,7 @@ if [ -z "${ZWE_CLI_PARAMETER_DRY_RUN}" ]; then

jobstate=$(wait_for_job "${jobid}")
code=$?
rm $jcl_file
if [ ${code} -eq 1 ]; then
print_error_and_exit "Error ZWEL0162E: Failed to find job ${jobid} result." "" 162
fi
Expand All @@ -124,4 +125,5 @@ else
print_message "JCL not submitted, command run with dry run flag."
print_message "To perform command, re-run command without dry run flag, or submit the JCL directly"
print_level2_message "Zowe Caching Service VSAM storage is created successfully."
rm $jcl_file
fi
2 changes: 1 addition & 1 deletion bin/commands/install/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ else
# FIXME: move these parts to zss commands.install?
# FIXME: ZWESIPRG is in zowe-install-packaging
cd "${ZWE_zowe_runtimeDirectory}/components/zss"
zss_samplib="ZWESAUX=ZWESASTC ZWESIP00 ZWESIS01=ZWESISTC ZWESISCH"
zss_samplib="ZWESASTC ZWESIP00 ZWESISTC ZWESISCH"
for mb in ${zss_samplib}; do
mb_from=$(echo "${mb}" | awk -F= '{print $1}')
mb_to=$(echo "${mb}" | awk -F= '{print $2}')
Expand Down
3 changes: 3 additions & 0 deletions bin/libs/zos-jes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ submit_job() {
code=$?
if [ ${code} -eq 0 ]; then
jobid=$(echo "${result}" | grep submitted | awk '{print $2}')
if [ -z "${jobid}" ]; then
jobid=$(echo "${result}" | grep "$HASP" | awk '{print $2}')
fi
if [ -z "${jobid}" ]; then
print_debug " * Failed to find job ID"
print_error " * Exit code: ${code}"
Expand Down
6 changes: 5 additions & 1 deletion bin/libs/zos-jes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export function submitJob(jclFile: string): string|undefined {
const code=result.rc;
if (code==0) {
let jobidlines = result.out.split('\n').filter(line=>line.indexOf('submitted')!=-1);
const jobid = jobidlines.length > 0 ? jobidlines[0].split(' ')[1] : undefined;
let jobid = jobidlines.length > 0 ? jobidlines[0].split(' ')[1] : undefined;
if (!jobid) {
jobidlines = result.out.split('\n').filter(line=>line.indexOf('$HASP')!=-1);
jobid = jobidlines.length > 0 ? jobidlines[0].split(' ')[1] : undefined;
}
if (!jobid) {
common.printDebug(` * Failed to find job ID`);
common.printError(` * Exit code: ${code}`);
Expand Down
4 changes: 2 additions & 2 deletions manifest.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"artifact": "*.pax"
},
"org.zowe.zss": {
"version": "^2.0.0-STAGING",
"version": "^2.14.0-PR-683",
"artifact": "*.pax"
},
"org.zowe.explorer.jobs.jobs-api-package": {
Expand Down Expand Up @@ -124,7 +124,7 @@
"artifact": "*.pax"
},
"org.zowe.launcher": {
"version": "^2.0.0-SNAPSHOT"
"version": "^2.15.0-PR-107"
},
"org.zowe.keyring-utilities": {
"version": "1.0.4",
Expand Down

0 comments on commit f4bdf39

Please sign in to comment.