# 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);
    });

## Index

### Classes

- CancelJobs
- DeleteJobs
- DownloadJobs
- GetJobs
- JobsConstants
- ModifyJobs
- MonitorJobs
- SearchJobs
- SubmitJobs

### Interfaces

- ICancelJob
- ICancelJobParms
- ICommonJobParms
- IDeleteJobParms
- IDownloadAllSpoolContentParms
- IDownloadSpoolContentParms
- IGetJclParms
- IGetJobsParms
- IJob
- IJobComplete
- IJobError
- IJobFeedback
- IJobFile
- IJobFileSimple
- IJobStepData
- IJobSubmit
- IModifyJob
- IModifyJobOptions
- IModifyJobParms
- IMonitorJobWaitForParms
- ISearchJobsParms
- ISpoolFile
- ISubmitJclNotifyParm
- ISubmitJclParms
- ISubmitJobNotifyParm
- ISubmitJobParms
- ISubmitJobUSSNotifyParm
- ISubmitJobUSSParms
- ISubmitParms
- ISubmitParmsCommon

### Type aliases

- JOB_STATUS
- JobDataResolve
- JobResolve

### Variables

- JOB_STATUS_ORDER

### Object literals

- ZosJobsMessages

## Type aliases

### JOB_STATUS

JOB_STATUS: "ACTIVE" | "OUTPUT" | "INPUT"

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/types/JobStatus.ts:17

The possible job status strings (as specified by the z/OSMF documentation). Used in the Jobs APIs for monitoring jobstatus, etc.

### JobDataResolve

JobDataResolve: (data: string) => void

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/types/JobDataResolve.ts:12

#### Type declaration

- - (data: string): void

  - #### Parameters

    - ##### data: string

    #### Returns void

### JobResolve

JobResolve: (job: IJob) => void

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/types/JobResolve.ts:14

#### Type declaration

- - (job: IJob): void

  - #### Parameters

    - ##### job: IJob

    #### Returns void

## Variables

### Const JOB_STATUS_ORDER

JOB_STATUS_ORDER: JOB_STATUS[] = ["INPUT", "ACTIVE", "OUTPUT"]

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/types/JobStatus.ts:29

## Object literals

### Const ZosJobsMessages

ZosJobsMessages: object

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:18

Messages to be used as command responses for different scenarios

### missingDirectoryOption

missingDirectoryOption: object

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:33

Message indicating that the "directory" option needs to be used if "extension" was used

memberof

  ZosJobsMessages

### message

message: string = "If you specify --extension option, you must also specify --directory"

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:34

### missingJcl

missingJcl: object

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:42

Message indicating that no JCL source was given

memberof

  ZosJobsMessages

### message

message: string = "No JCL provided"

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:43

### missingSearchOption

missingSearchOption: object

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:51

Message indicating that no search option was passed or both were passed

memberof

  ZosJobsMessages

### message

message: string = "You must specify either the `--search-string` or `--search-regex` option"

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:52

### missingUssFilePath

missingUssFilePath: object

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:24

Message indicating that the USS file path is required

memberof

  ZosJobsMessages

### message

message: string = "Specify the USS file path."

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:25

### nodeJsFsError

nodeJsFsError: object

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:58

Message indicating that a failure has happened in the NodeJS File System API

### message

message: string = "Node.js File System API error"

- Defined in @zowe/zos-jobs-for-zowe-sdk/src/JobsMessages.ts:59

Generated using TypeDoc