# z/OS TSO Package

Contains APIs to interact with TSO on z/OS (using z/OSMF TSO REST endpoints).

## API Examples

Issue the TSO command "status" to display info about jobs for your user ID

    import { ProfileInfo } from "@zowe/imperative";
    import { IssueTso } from "@zowe/zos-tso-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);

        // Load account number from default TSO profile (optional)
        const tsoProfAttrs = profInfo.getDefaultProfile("tso");
        const tsoMergedArgs = profInfo.mergeArgsForProfile(tsoProfAttrs);
        const accountNumberFromProfile = tsoMergedArgs.knownArgs.find(
            arg => arg.argName === "account").argValue as string;

        const accountNumber = accountNumberFromProfile || "ACCT#";
        const command = "status";
        const response = await IssueTso.issueTsoCommand(session, accountNumber, command);
        if (response.success) {
            console.log(response);
        } else {
            throw new Error(`Failed to issue TSO command "${command}"`);
        }
    })().catch((err) => {
        console.error(err);
        process.exit(1);
    });

#

Demonstrate starting, pinging, and stopping a TSO address space

    import { ProfileInfo } from "@zowe/imperative";
    import { PingTso, StartTso, StopTso } from "@zowe/zos-tso-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 accountNumber = "ACCT#";
        const startResponse = await StartTso.start(session, accountNumber, {
            codePage: "285"
        });

        const servletKey = startResponse.servletKey;
        if (startResponse.success) {
            console.log(`[${servletKey}] Started`);
        } else {
            throw new Error("Failed to start TSO address space");
        }

        const pingResponse = await PingTso.ping(session, servletKey);
        if (pingResponse.success) {
            console.log(`[${servletKey}] Ping succeeded`);
        } else {
            throw new Error("Failed to ping TSO address space");
        }

        const stopResponse = await StopTso.stop(session, servletKey);
        if (stopResponse.success) {
            console.log(`[${servletKey}] Stopped`);
        } else {
            throw new Error("Failed to stop TSO address space");
        }

        try {
            await PingTso.ping(session, servletKey);
        } catch {
            console.log(`[${servletKey}] Ping failed`);
        }
    })().catch((err) => {
        console.error(err);
        process.exit(1);
    });

## Index

### Classes

- AddressSpaceApps
- IssueTso
- PingTso
- SendTso
- StartTso
- StopTso
- TsoConstants
- TsoProfileConstants
- TsoResponseService
- TsoValidator
- ZosTsoBaseHandler

### Interfaces

- IASAppResponse
- ICollectedResponses
- IIssueResponse
- IIssueTsoCmdOpts
- IIssueTsoCmdResponse
- IIssueTsoParms
- IPingResponse
- ISendResponse
- ISendTsoParms
- IStartStopResponse
- IStartStopResponses
- IStartTsoAppParms
- IStartTsoParms
- IStopTsoParms
- ITsoAppCommunicationParms
- ITsoMessage
- ITsoMessages
- ITsoPromptMessage
- ITsoResponseMessage
- IZosmfMessages
- IZosmfPingResponse
- IZosmfTsoResponse

### Type aliases

- SendResponse

### Object literals

- ZosTsoProfile
- noAccountNumber
- noCommandInput
- noDataInput
- noPingInput
- noServletKeyInput
- noSessionTso
- noTsoIssueInput
- noTsoStartInput
- noTsoStopInput
- noZosmfResponse

## Type aliases

### SendResponse

SendResponse: (response: ISendResponse) => void

- Defined in @zowe/zos-tso-for-zowe-sdk/src/doc/types/SendResponse.ts:14

#### Type declaration

- - (response: ISendResponse): void

  - #### Parameters

    - ##### response: ISendResponse

    #### Returns void

## Object literals

### Const ZosTsoProfile

ZosTsoProfile: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:20

Profile configuration for TSO profiles

memberof

  ZosTsoProfile

### type

type: string = "tso"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:21

### schema

schema: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:22

### description

description: string = "z/OS TSO/E User Profile"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:25

### required

required: undefined[] = []

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:59

### title

title: string = "TSO Profile"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:24

### type

type: string = "object"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:23

### properties

properties: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:26

### account

account: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:27

### includeInTemplate

includeInTemplate: boolean = true

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:30

### optionDefinition

optionDefinition: any = TsoProfileConstants.TSO_OPTION_ACCOUNT_PROFILE

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:29

### type

type: string = "string"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:28

### characterSet

characterSet: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:32

### optionDefinition

optionDefinition: any = TsoProfileConstants.TSO_OPTION_CHAR_SET

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:34

### type

type: string = "string"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:33

### codePage

codePage: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:36

### includeInTemplate

includeInTemplate: boolean = true

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:39

### optionDefinition

optionDefinition: any = TsoProfileConstants.TSO_OPTION_CODE_PAGE

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:38

### type

type: string = "string"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:37

### columns

columns: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:41

### optionDefinition

optionDefinition: any = TsoProfileConstants.TSO_OPTION_COLUMNS

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:43

### type

type: string = "number"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:42

### logonProcedure

logonProcedure: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:45

### includeInTemplate

includeInTemplate: boolean = true

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:48

### optionDefinition

optionDefinition: any = TsoProfileConstants.TSO_OPTION_LOGON_PROCEDURE

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:47

### type

type: string = "string"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:46

### regionSize

regionSize: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:50

### optionDefinition

optionDefinition: any = TsoProfileConstants.TSO_OPTION_REGION_SIZE

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:52

### type

type: string = "number"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:51

### rows

rows: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:54

### optionDefinition

optionDefinition: any = TsoProfileConstants.TSO_OPTION_ROWS

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:56

### type

type: string = "number"

- Defined in @zowe/zos-tso-for-zowe-sdk/src/constants/ZosTso.profile.ts:55

### Const noAccountNumber

noAccountNumber: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:239

No account number was provided error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No account number was supplied.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:240

### Const noCommandInput

noCommandInput: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:269

No command text was provided error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No command text was provided.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:270

### Const noDataInput

noDataInput: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:259

No data parameter string was supplied error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No data parameter string was supplied.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:260

### Const noPingInput

noPingInput: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:229

No servlet key was provided for Ping command error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No servlet supplied.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:230

### Const noServletKeyInput

noServletKeyInput: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:249

No servlet key was provided error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No servlet key was supplied.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:250

### Const noSessionTso

noSessionTso: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:179

No Session provided error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No session was supplied.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:180

### Const noTsoIssueInput

noTsoIssueInput: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:199

No input parameters were provided error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No tso issue command parameters were supplied.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:200

### Const noTsoStartInput

noTsoStartInput: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:189

No input parameters were provided error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No tso start address space parameters were supplied.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:190

### Const noTsoStopInput

noTsoStopInput: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:209

No input parameters for stop were provided error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No tso stop address space parameters were supplied.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:210

### Const noZosmfResponse

noZosmfResponse: object

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:219

No ZOSMF response was received error message

static
memberof

  TsoConstants

### message

message: string = apiErrorHeader.message + ` No z/OSMF response was received.`

- Defined in @zowe/zos-tso-for-zowe-sdk/src/TsoConstants.ts:220

Generated using TypeDoc