@zowe/zos-jobs-for-zowe-sdk
TypeScript icon, indicating that this package has built-in type declarations

7.25.0 • Public • Published

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 { ProfileInfo } from "@zowe/imperative";
import { CancelJobs } from "@zowe/zos-jobs-for-zowe-sdk";

(async () => {
    // Load connection info from default z/OSMF profile
    const profInfo = new ProfileInfo("zowe");
    await profInfo.readProfilesFromDisk();
    const zosmfProfAttrs = profInfo.getDefaultProfile("zosmf");
    const zosmfMergedArgs = profInfo.mergeArgsForProfile(zosmfProfAttrs, { getSecureVals: true });
    const session = ProfileInfo.createSession(zosmfMergedArgs.knownArgs);

    const jobName: string = "JOBNAME";
    const jobId: string = "JOBID";
    const version: string = undefined;
    const response = await CancelJobs.cancelJob(session, jobName, jobId, version);
    console.log(response);
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Download a job's output

import { ProfileInfo } from "@zowe/imperative";
import { DownloadJobs, IDownloadAllSpoolContentParms } from "@zowe/zos-jobs-for-zowe-sdk";

(async () => {
    // Load connection info from default z/OSMF profile
    const profInfo = new ProfileInfo("zowe");
    await profInfo.readProfilesFromDisk();
    const zosmfProfAttrs = profInfo.getDefaultProfile("zosmf");
    const zosmfMergedArgs = profInfo.mergeArgsForProfile(zosmfProfAttrs, { getSecureVals: true });
    const session = ProfileInfo.createSession(zosmfMergedArgs.knownArgs);

    const jobParms: IDownloadAllSpoolContentParms = {
        jobname: "JOBNAME",
        jobid: "JOBID",
        outDir: undefined,
        extension: ".txt",
        omitJobidDirectory: false
    };
    const response = await DownloadJobs.downloadAllSpoolContentCommon(session, jobParms);
    console.log(response);
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Get jobs by owner

import { ProfileInfo } from "@zowe/imperative";
import { GetJobs } from "@zowe/zos-jobs-for-zowe-sdk";

(async () => {
    // Load connection info from default z/OSMF profile
    const profInfo = new ProfileInfo("zowe");
    await profInfo.readProfilesFromDisk();
    const zosmfProfAttrs = profInfo.getDefaultProfile("zosmf");
    const zosmfMergedArgs = profInfo.mergeArgsForProfile(zosmfProfAttrs, { getSecureVals: true });
    const session = ProfileInfo.createSession(zosmfMergedArgs.knownArgs);

    const owner: string = session.ISession.user;
    // This may take awhile...
    const response = await GetJobs.getJobsByOwner(session, owner);
    console.log(response);
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Submit a job

import { ProfileInfo } from "@zowe/imperative";
import { SubmitJobs } from "@zowe/zos-jobs-for-zowe-sdk";

(async () => {
    // Load connection info from default z/OSMF profile
    const profInfo = new ProfileInfo("zowe");
    await profInfo.readProfilesFromDisk();
    const zosmfProfAttrs = profInfo.getDefaultProfile("zosmf");
    const zosmfMergedArgs = profInfo.mergeArgsForProfile(zosmfProfAttrs, { getSecureVals: true });
    const session = ProfileInfo.createSession(zosmfMergedArgs.knownArgs);

    const jobDataSet: string = "ZOWEUSER.PUBLIC.MY.DATASET.JCL(MEMBER)";
    const response = await SubmitJobs.submitJob(session, jobDataSet);
    console.log(response);
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Package Sidebar

Install

npm i @zowe/zos-jobs-for-zowe-sdk

Weekly Downloads

1,573

Version

7.25.0

License

EPL-2.0

Unpacked Size

243 kB

Total Files

126

Last publish

Collaborators

  • joe_winchester
  • zowerobot
  • markackertbroadcom