Created
April 20, 2022 16:01
-
-
Save dkelosky/fad6c1e37cfb34a6bcbd5d8f6ed698ef to your computer and use it in GitHub Desktop.
index.mjs delete
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { zowe } from "./zowe.mjs"; | |
import { basename } from "path"; | |
const prefix = process.argv[2]; | |
if (!prefix) { console.log(`Job prefix is missing, usage is 'node ${basename(process.argv[1])} <job-prefix>'`); process.exit(1); } | |
const resp = zowe(`jobs list jobs --prefix ${prefix}`, {json: true, silent: true}); | |
const jsonResp = JSON.parse(resp); | |
jsonResp.data.forEach(job => { | |
if (job.status === `OUTPUT` && job.retcode === `CC 0000`) { | |
zowe(`jobs delete job ${job.jobid}`); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment