@zowe/zos-jobs-for-zowe-sdk v7.24.0
z/OS Jobs Package
Contains APIs to interact with jobs on z/OS (using z/OSMF jobs REST endpoints).
API Examples
Cancel a job
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError,
CredentialManagerFactory } from "@zowe/imperative";
import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk";
import { getDefaultProfile } from "@zowe/core-for-zowe-sdk";
import { CancelJobs } from "@zowe/zos-jobs-for-zowe-sdk";
(async () => {
//Initialize the Imperative Credential Manager Factory and Logger
Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'}));
// Uncommment the below line if the Secure Credential Store is in use
// await CredentialManagerFactory.initialize({service: "Zowe-Plugin"});
// Get the default z/OSMF profile and create a z/OSMF session with it
let defaultZosmfProfile: IProfile;
try {
defaultZosmfProfile = await getDefaultProfile("zosmf", true);
} catch (err) {
throw new ImperativeError({msg: "Failed to get a profile."});
}
// Job Options
const jobName: string = "MYJOB";
const jobId: string = "JOBID";
const version: string = undefined;
const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile);
let response: any;
response = await CancelJobs.cancelJob(session, jobName, jobId, version);
console.log(response);
process.exit(0);
})().catch((err) => {
console.error(err);
process.exit(1);
});
Download a job's output
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError,
CredentialManagerFactory } from "@zowe/imperative";
import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk";
import { getDefaultProfile } from "@zowe/core-for-zowe-sdk";
import { DownloadJobs, IDownloadAllSpoolContentParms } from "@zowe/zos-jobs-for-zowe-sdk";
(async () => {
//Initialize the Imperative Credential Manager Factory and Logger
Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'}));
// Uncommment the below line if the Secure Credential Store is in use
// await CredentialManagerFactory.initialize({service: "Zowe-Plugin"});
// Get the default z/OSMF profile and create a z/OSMF session with it
let defaultZosmfProfile: IProfile;
try {
defaultZosmfProfile = await getDefaultProfile("zosmf", true);
} catch (err) {
throw new ImperativeError({msg: "Failed to get a profile."});
}
// Job Options
const jobParms: IDownloadAllSpoolContentParms = {
jobname: "JOBNAME",
jobid: "JOBID",
outDir: undefined,
extension: ".txt",
omitJobidDirectory: false
}
const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile);
let response: any;
response = await DownloadJobs.downloadAllSpoolContentCommon(session, jobParms);
console.log(response);
process.exit(0);
})().catch((err) => {
console.error(err);
process.exit(1);
});
Get jobs by owner
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError,
CredentialManagerFactory } from "@zowe/imperative";
import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk";
import { getDefaultProfile } from "@zowe/core-for-zowe-sdk";
import { GetJobs, IJob } from "@zowe/zos-jobs-for-zowe-sdk";
(async () => {
//Initialize the Imperative Credential Manager Factory and Logger
Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'}));
// Uncommment the below line if the Secure Credential Store is in use
// await CredentialManagerFactory.initialize({service: "Zowe-Plugin"});
// Get the default z/OSMF profile and create a z/OSMF session with it
let defaultZosmfProfile: IProfile;
try {
defaultZosmfProfile = await getDefaultProfile("zosmf", true);
} catch (err) {
throw new ImperativeError({msg: "Failed to get a profile."});
}
// Job Options
const owner: string = defaultZosmfProfile.user;
const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile);
let response: IJob[];
// This may take awhile...
response = await GetJobs.getJobsByOwner(session, owner);
console.log(response);
process.exit(0);
})().catch((err) => {
console.error(err);
process.exit(1);
});
Submit a job
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError,
CredentialManagerFactory } from "@zowe/imperative";
import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk";
import { getDefaultProfile } from "@zowe/core-for-zowe-sdk";
import { SubmitJobs, IJob, ISubmitJobParms } from "@zowe/zos-jobs-for-zowe-sdk";
(async () => {
//Initialize the Imperative Credential Manager Factory and Logger
Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'}));
// Uncommment the below line if the Secure Credential Store is in use
// await CredentialManagerFactory.initialize({service: "Zowe-Plugin"});
// Get the default z/OSMF profile and create a z/OSMF session with it
let defaultZosmfProfile: IProfile;
try {
defaultZosmfProfile = await getDefaultProfile("zosmf", true);
} catch (err) {
throw new ImperativeError({msg: "Failed to get a profile."});
}
// Job Options
const jobDataSet: string = "ZOWEUSER.PUBLIC.MY.DATASET.JCL(MEMBER)"
const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile);
let response: IJob;
response = await SubmitJobs.submitJob(session, jobDataSet);
console.log(response);
process.exit(0);
})().catch((err) => {
console.error(err);
process.exit(1);
});
4 days ago
12 days ago
20 days ago
22 days ago
27 days ago
27 days ago
27 days ago
29 days ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
7 months ago
8 months ago
9 months ago
8 months ago
6 months ago
6 months ago
5 months ago
9 months ago
5 months ago
5 months ago
10 months ago
10 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
9 months ago
7 months ago
5 months ago
5 months ago
6 months ago
5 months ago
12 months ago
11 months ago
11 months ago
11 months ago
10 months ago
12 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago