IBM RSE API Plug-in for Zowe CLI as nodejs SDK reference



Admin

cancelActivity

static cancelActivity(session: imperative.Session, service?: string) : Promise<void>

Parameters

  • session (imperative.Session)
  • service (string) — optional
 Cancels an activity for the user issuing the request in the ZOS system.
  @param session - The session object used for authentication and communication with the ZOS system.
  @param service - The service name to be used in the request headers. If not provided, all services for the issuing user will be targeted.
  @returns A promise that resolves when the activity is successfully cancelled.

validService

static validService(service: string) : void

Parameters

  • service (string)
 Validates the provided service name.
  @param service - The service name to be validated.
  @throws
  Error, Throws an error if the service name is invalid.

Archives

createArchiveEntry

static createArchiveEntry(session: imperative.Session, archivePath: string, relativePath: string, type: 'file' | 'directory') : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • archivePath (string)
  • relativePath (string)
  • type ('file' | 'directory')
 Create a dir/file inside an archive.
  @param session - RSE API session.
  @param archivePath - Path to the archive on USS.
  @param relativePath - Path to the file inside the archive.
  @param type - Type of entry to create within the archive path.
  @returns A success response after updating the file.
  @public

deleteContentArchiveFile

static deleteContentArchiveFile(session: imperative.Session, archivePath: string, relativePath: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • archivePath (string)
  • relativePath (string)
 Deletes a specific file from a z/OS UNIX archive.
  @param session - The RSE session for the REST API.
  @param archivePath - Full path to the archive on USS.
  @param relativePath - Path to the file inside the archive to delete.
  @returns A success response after deletion.
  @public

exportFromArchive

static exportFromArchive(session: imperative.Session, archivePath: string, relativePath: string, destinationPath: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • archivePath (string)
  • relativePath (string)
  • destinationPath (string)
 Export a UNIX File/Folder from an archive, to a destination path.
  @param session - RSE API session.
  @param archivePath - Path to the archive on USS.
  @param relativePath - Path to the file inside the archive.
  @param path - Path to export to.
  @returns A success response after updating the file.
  @public

getContentArchiveFile

static getContentArchiveFile(session: imperative.Session, archivePath: string, relativePath: string, options?: IDownloadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • archivePath (string)
  • relativePath (string)
  • options (IDownloadRseOptions) — optional
 Retrieves the contents of a file within an archive on USS and optionally saves it locally.
  @param session - The RSE API session.
  @param archivePath - Path to the archive file.
  @param relativePath - Relative path to the file inside the archive.
  @param options - IDownloadRseOptions for download settings.
  @returns A success response with file content or download result.
  @public

importToArchive

static importToArchive(session: imperative.Session, archivePath: string, relativePath: string, sourcePath: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • archivePath (string)
  • relativePath (string)
  • sourcePath (string)
 Import a UNIX File/Folder into an archive, from a source path.
  @param session - RSE API session.
  @param archivePath - Path to the archive on USS.
  @param relativePath - Path within the archive to import to.
  @param sourcePath - Path to import from.
  @returns A success response after updating the file.
  @public

listArchiveFiles

static listArchiveFiles(session: imperative.Session, archivePath: string, relativePath?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • archivePath (string)
  • relativePath (string) — optional
 Lists the files and folders within the specified path of the z/OS UNIX archive.
  @param session - The RSE API session object.
  @param archivePath - The absolute path to the archive file on USS.
  @param relativePath - The relative path to the target directory inside the archive.
  @returns A success response with the list of files and directories in the archive.
  @public

updateContentArchiveFile

static updateContentArchiveFile(session: imperative.Session, archivePath: string, relativePath: string, options?: IDownloadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • archivePath (string)
  • relativePath (string)
  • options (IDownloadRseOptions) — optional
 Updates the content of a file inside an archive using a local file.
  @param session - RSE API session.
  @param archivePath - Path to the archive on USS.
  @param relativePath - Path to the file inside the archive.
  @param options - Different API options.
  @returns A success response after updating the file.
  @public

AuthLogin

getToken

static getToken(session: imperative.Session, profileName: string, profile: imperative.IProfile, autoRefreshToken?: boolean) : Promise<imperative.Session>

Parameters

  • session (imperative.Session)
  • profileName (string)
  • profile (imperative.IProfile)
  • autoRefreshToken (boolean) — optional
 Log in to authenticate and retrieves a new authentication token for the provided session and profile.
  @param session - The session object containing user credentials.
  @param profileName - The name of the profile to use for authentication.
  @param profile - The profile object containing user credentials.
  @param autoRefreshToken - Optional flag to enable automatic token refresh.
  @returns imperative.Session, A promise that resolves to the updated session object.

refreshToken

static refreshToken(session: imperative.Session, profileName: string, profile: imperative.IProfile, autoRefreshToken?: boolean) : Promise<imperative.Session>

Parameters

  • session (imperative.Session)
  • profileName (string)
  • profile (imperative.IProfile)
  • autoRefreshToken (boolean) — optional
 Refreshes an existing token authentication for the provided session and profile to extend its validity.
  @param session - The session object containing user credentials.
  @param profileName - The name of the profile to use for authentication.
  @param profile - The profile object containing user credentials.
  @param autoRefreshToken - Optional flag to enable automatic token refresh.
  @returns imperative.Session, A promise that resolves to the updated session object.

validateToken

static validateToken(session: imperative.Session, tokenHeader?: {}) : Promise<ITokenInfo>

Parameters

  • session (imperative.Session)
  • tokenHeader ({}) — optional
 Validates the provided token for the given session.
  @param session - The session object containing user credentials.
  @param tokenHeader - Optional token header object.
  @returns ITokenInfo, A promise that resolves to the token information.

AuthLogout

expireToken

static expireToken(session: imperative.Session, profileName: string, profile: imperative.IProfile) : Promise<void>

Parameters

  • session (imperative.Session)
  • profileName (string)
  • profile (imperative.IProfile)
 Logout current client session and updates the profile information.
  @param session - The current session object.
  @param profileName - The name of the profile to update.
  @param profile - The profile object to update.
  @returns A Promise that resolves when the token is retired and the profile is updated.

updateProfileFile

static updateProfileFile(profileName: string, profile?: imperative.IProfile) : Promise<void>

Parameters

  • profileName (string)
  • profile (imperative.IProfile) — optional
 Updates the profile file with the new token information.
  @param profileName - The name of the profile to update.
  @returns A Promise that resolves when the profile file is updated.

AuthUtils

checkAuthCreds

static checkAuthCreds(session: imperative.Session, commandParameters: imperative.IHandlerParameters) : Promise<imperative.Session>

Parameters

  • session (imperative.Session)
  • commandParameters (imperative.IHandlerParameters)
 Checks the authentication credentials and updates the session if necessary.
  @param session - imperative.Session object.
  @param commandParameters - imperative.IHandlerParameters object.
  @returns imperative.Session, A promise that resolves to the updated session object.

checkProfileToken

static checkProfileToken(session: imperative.Session, params: imperative.IHandlerParameters, profile: imperative.IProfile) : Promise<imperative.Session>

Parameters

  • session (imperative.Session)
  • params (imperative.IHandlerParameters)
  • profile (imperative.IProfile)
 Checks the RSE profile for a valid token and updates the session if necessary.
  @param session - imperative.Session object.
  @param params - imperative.IHandlerParameters object.
  @param profile - imperative.IProfile object.
  @returns imperative.Session, A promise that resolves to the updated session object.

performLogin

static performLogin(session: imperative.Session, commandParameters: imperative.IHandlerParameters, profile: imperative.IProfile) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • commandParameters (imperative.IHandlerParameters)
  • profile (imperative.IProfile)
 Perform login prompts, used both during login and re-auth
  @param session - imperative.Session object.
  @param commandParameters - imperative.IHandlerParameters object.
  @param profile - imperative.IProfile object.
  @returns

promptUserPass

static promptUserPass(session: imperative.Session) : Promise<imperative.Session>

Parameters

  • session (imperative.Session)
 Prompts the user for their username and password.
  @param session - imperative.Session object.
  @returns imperative.Session, A promise that resolves to the updated session object.

CancelJobs

cancelJob

static cancelJob(session: imperative.Session, jobname: string, jobid: string, version?: string) : Promise<void>

Parameters

  • session (imperative.Session)
  • jobname (string)
  • jobid (string)
  • version (string) — optional
 Cancel a job using job name and job id.
  @param session - connection info
  @param jobname - job name to be translated into parms object
  @param jobid - job id to be translated into parms object
  @param version - version of cancel request (optional)
  @returns A promise that resolves when the API call is complete

cancelJobForJob

static cancelJobForJob(session: imperative.Session, job: zoweJob.IJob, version?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • job (zoweJob.IJob)
  • version (string) — optional
 Cancel a job using an IJob object.
  @param session - connection info
  @param job - the job that you want to cancel
  @param version - version of cancel request (optional)
  @returns An IRestApiResponse promise that resolves with an object containing success status, command response, and API response

ChangePassword

promptsChangePassword

static promptsChangePassword(session: imperative.Session, commandParameters: imperative.IHandlerParameters) : Promise<IChangePassword>

Parameters

  • session (imperative.Session)
  • commandParameters (imperative.IHandlerParameters)
 Prompts the user for current password, new password, and verifies the new password.
  @param session - RSE API connection information.
  @param commandParameters - Command parameters.
  @returns IChangePassword, A promise that resolves to an object containing current user, current password, and new password.

setNewPassword

static setNewPassword(session: imperative.Session, profile: imperative.IProfile, newPassword: string, profileName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • profile (imperative.IProfile)
  • newPassword (string)
  • profileName (string)
 Changes the password for the specified user profile.
  @param session - RSE API connection information.
  @param profile - User profile details.
  @param newPassword - New password to be set.
  @param profileName - Name of the user profile.
  @returns IRestApiResponse, A promise that resolves to an object containing success status, command response, and API response.

ChangeProperties

changeProperties

static changeProperties(session: imperative.Session, ussPath: string, properties: {
        owner?: string;
        group?: string;
        permissions?: string;
        tag?: string;
    }) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussPath (string)
  • properties ({ owner?: string; group?: string; permissions?: string; tag?: string; })
 Changes various properties of a USS file.
  @param session - RSE connection info
  @param ussPath - contains the uss file path
  @param properties - Properties to change, including optional 'owner', 'group', 'permissions', and 'tag'
  @returns IRestApiResponse, Promise that resolves to the API response

changeTag

static changeTag(session: imperative.Session, ussPath: string, properties: {
        tag?: string;
    }) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussPath (string)
  • properties ({ tag?: string; })
 Changes the tag of a USS file.
  @param session - RSE connection info
  @param ussPath - contains the uss file path
  @param properties - Properties to change, including optional 'tag'
  @returns IRestApiResponse, Promise that resolves to the API response

clearTag

static clearTag(session: imperative.Session, ussPath: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussPath (string)
 Clears the tag from a USS file.
  @param session - RSE connection info
  @param ussPath - contains the uss file path
  @returns IRestApiResponse, Promise that resolves to the API response

convertFileEncoding

static convertFileEncoding(session: imperative.Session, ussPath: string, properties: {
        sourceEncoding: string;
        targetEncoding: string;
    }) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussPath (string)
  • properties ({ sourceEncoding: string; targetEncoding: string; })
 Converts the encoding of a USS file to the target encoding.
  @param session - RSE connection info
  @param ussPath - contains the uss file path
  @param properties - Properties to change, including 'sourceEncoding' and 'targetEncoding'
  @returns IRestApiResponse, Promise that resolves to the API response

CheckAddressSpace

getJobsInfo

static getJobsInfo(session: imperative.Session, args: imperative.ICommandArguments) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • args (imperative.ICommandArguments)
 Retrieves active job address space information.
  @param session - The session object for the REST client.
  @param args - Optional command arguments for filtering the job information.
  @returns An IRestApiResponse promise that resolves to an object containing the active job address space information response.

getSystemInfo

static getSystemInfo(session: imperative.Session) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
 Retrieves system address space information
  @param session - The session object for the REST client.
  @returns An IRestApiResponse promise that resolves to an object containing the system address space information response

CheckExpiry

getExpiry

static getExpiry(session: imperative.Session) : Promise<string>

Parameters

  • session (imperative.Session)
 Retrieves the password expiration date from the server.
  @param session - The session object containing user credentials.
  @returns A promise that resolves to a string representing the password expiration date.

CheckMappings

compareMappingsFile

static compareMappingsFile(session: imperative.Session) : Promise<number>

Parameters

  • session (imperative.Session)
 Compares the local mappings file with the server's mappings file.
  @param session - The Zowe session object.
  @returns number, A Promise that resolves with a number indicating the comparison result.

encodingPrecedence

static encodingPrecedence(profileEncoding: string, optionsEncoding: string, dataSetName: string, mappingsFile?: string) : Promise<string | undefined>

Parameters

  • profileEncoding (string)
  • optionsEncoding (string)
  • dataSetName (string)
  • mappingsFile (string) — optional
 Determines the encoding precedence between profile encoding, options encoding, and mappings file.
  @param profileEncoding - The encoding from the profile.
  @param optionsEncoding - The encoding from the options.
  @param dataSetName - The name of the data set.
  @param mappingsFile - Optional path to the mapping file.
  @returns string, A Promise that resolves with the determined encoding or undefined if not found.

getDefaultMappingsPath

static getDefaultMappingsPath(fileName?: string) : string

Parameters

  • fileName (string) — optional
 Gets the default path for the mappings file.
  @param fileName - Optional name of the mappings file.
  @returns string ,The default path for the mappings file.

getDlExtensionFromMappings

static getDlExtensionFromMappings(dataSetName: string, mappingsFile?: string) : Promise<string>

Parameters

  • dataSetName (string)
  • mappingsFile (string) — optional
 Gets the DL extension from the mappings file.
  @param dataSetName - The name of the data set.
  @param mappingsFile - Optional path to the mapping file.
  @returns string, A Promise that resolves with the DL extension or undefined if not found.

getMappingEncoding

static getMappingEncoding(dataSetName: string, mappingsFile?: string) : Promise<string | undefined>

Parameters

  • dataSetName (string)
  • mappingsFile (string) — optional
 Reads mapping file if it exists and returns encoding based on the encoding set for data set resource value or default for download of MVS files.
  @param dataSetName - The name of the data set.
  @param mappingsFile - Optional path to the mapping file.
  @returns string | undefined, A Promise that resolves with the encoding or undefined if not found.

getMappingFile

static getMappingFile(session: imperative.Session, force: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • force (boolean)
 Downloads Mapping file from RSE API.
  @param session - The Zowe session object.
  @param force - A boolean indicating whether to force download even if the file exists.
  @returns IRestApiResponse, A Promise that resolves with an object containing success status, command response, and API response.

getSpecifiedMappingsPath

static getSpecifiedMappingsPath(mappingsFile: string) : string

Parameters

  • mappingsFile (string)
 Gets the specified path for the mappings file.
  @param mappingsFile - The path to the mappings file.
  @returns string, The specified path for the mappings file.

mappingFileExist

static mappingFileExist(fileName?: string, filePath?: string) : boolean

Parameters

  • fileName (string) — optional
  • filePath (string) — optional
 Checks if mapping file exists in '.zowe/profiles/rse'.
  @param fileName - Optional name of the mapping file.
  @param filePath - Optional path to the mapping file.
  @returns boolean, A boolean indicating whether the file exists.

CheckStatus

apiVersionCheck

static apiVersionCheck(session: imperative.Session, version: number[]) : Promise<void>

Parameters

  • session (imperative.Session)
  • version (number[])
 Checks the API version of the RSE for feature availability.
  @param session - The session object used to communicate with the RSE.
  @param version - An array of integers representing the desired API version.
  @returns A promise that resolves to void.

getRseStatus

static getRseStatus(session: imperative.Session) : Promise<object>

Parameters

  • session (imperative.Session)
 Retrieves the status of an RSE server connection.
  @param session - The session object used to communicate with the RSE.
  @returns A promise that resolves to an object containing the RSE status information.

meetsApiVersionRequirement

static meetsApiVersionRequirement(session: imperative.Session, minVersion: number[]) : Promise<boolean>

Parameters

  • session (imperative.Session)
  • minVersion (number[])
 Determines whether the RSE API meets the specified minimum version requirement.
  This method performs a version check against the RSE server and returns a boolean result instead of throwing errors, making it suitable for feature gating and conditional logic.
  @param session - The session object used to communicate with the RSE.
  @param minVersion - An array of integers representing the minimum required API version.
  @returns A promise that resolves to true if the RSE API version meets or exceeds the required version; otherwise, false.

ClassificationScan

scanContainer

static scanContainer(session: imperative.Session, containerPath: string, resultsHandler: (data: string) => void, hostEncoding?: string, filenameFilter?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • containerPath (string)
  • resultsHandler ((data: string) =) void)
  • hostEncoding (string) — optional
  • filenameFilter (string) — optional
 Scans a container and processes the results using a callback.
  @param session - The Zowe session.
  @param containerPath - The path of the container to scan.
  @param resultsHandler - A callback function to process the scan results.
  @param hostEncoding - Optional host encoding.
  @param filenameFilter - Optional filename filter.
  @returns Promise of IRestApiResponse, A Promise that resolves to an object containing the scan results.

scanContent

static scanContent(session: imperative.Session, content: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • content (string)
 Scans the content and returns the scan results.
  @param session - The Zowe session.
  @param content - The content to scan.
  @returns Promise of IRestApiResponse, A Promise that resolves to an object containing the scan results.

scanResource

static scanResource(session: imperative.Session, resourcePath: string, hostEncoding?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • resourcePath (string)
  • hostEncoding (string) — optional
 Scans a resource and returns the scan results.
  @param session - The Zowe session.
  @param resourcePath - The path of the resource to scan.
  @param hostEncoding - Optional host encoding.
  @returns Promise of IRestApiResponse, A Promise that resolves to an object containing the scan results.

CommonProperties

copyNamespace

static copyNamespace(session: imperative.Session, fromNamespaceName: string, toNamespaceName: string, isPrivateNamespace?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • fromNamespaceName (string)
  • toNamespaceName (string)
  • isPrivateNamespace (boolean) — optional
 Copies a namespace from one name to another.
  @param session - The session object for the API calls.
  @param fromNamespaceName - The name of the source namespace.
  @param toNamespaceName - The name of the destination namespace.
  @param isPrivateNamespace - Optional flag to indicate if the namespace is private.
  @returns A promise that resolves to an object containing the success status, command response, and API response.

createNamespace

static createNamespace(session: imperative.Session, namespaceName: string, isPrivateNamespace?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • namespaceName (string)
  • isPrivateNamespace (boolean) — optional
 Creates a new namespace.
  @param session - The session object for the API calls.
  @param namespaceName - The name of the new namespace.
  @param isPrivateNamespace - Optional flag to indicate if the namespace is private.
  @returns A promise that resolves to an object containing the success status, command response, and API response.

delete

static delete(session: imperative.Session, namespaceName: string, propertyPath?: string, isPrivateNamespace?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • namespaceName (string)
  • propertyPath (string) — optional
  • isPrivateNamespace (boolean) — optional
 Deletes a namespace or a property within a namespace.
  @param session - The session object for the API calls.
  @param namespaceName - The name of the namespace to delete.
  @param propertyPath - Optional path to a specific property within the namespace.
  @param isPrivateNamespace - Optional flag to indicate if the namespace is private.
  @returns A promise that resolves to an object containing the success status, command response, and API response.

getNamespaceProperty

static getNamespaceProperty(session: imperative.Session, namespaceName: string, propertyPath?: string, isPrivateNamespace?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • namespaceName (string)
  • propertyPath (string) — optional
  • isPrivateNamespace (boolean) — optional
 Retrieves a property within a namespace.
  @param session - The session object for the API calls.
  @param namespaceName - The name of the namespace containing the property.
  @param propertyPath - The path to the property within the namespace.
  @param isPrivateNamespace - Optional flag to indicate if the namespace is private.
  @returns A promise that resolves to an object containing the success status, command response, and API response.

listAllNamespaces

static listAllNamespaces(session: imperative.Session, isPrivateNamespace?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • isPrivateNamespace (boolean) — optional
 Lists all namespaces.
  @param session - The session object for the API calls.
  @param isPrivateNamespace - Optional flag to indicate if only private namespaces should be listed.
  @returns A promise that resolves to an object containing the success status, command response, and API response.

renameNamespace

static renameNamespace(session: imperative.Session, beforeNamespaceName: string, afterNamespaceName: string, isPrivateNamespace?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • beforeNamespaceName (string)
  • afterNamespaceName (string)
  • isPrivateNamespace (boolean) — optional
 Renames a namespace.
  @param session - The session object for the API calls.
  @param beforeNamespaceName - The current name of the namespace.
  @param afterNamespaceName - The new name for the namespace.
  @param isPrivateNamespace - Optional flag to indicate if the namespace is private.
  @returns A promise that resolves to an object containing the success status, command response, and API response.

setNamespaceProperty

static setNamespaceProperty(session: imperative.Session, namespaceName: string, propertyPath: string, propertyValue: string, propertyType?: string, isPrivateNamespace?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • namespaceName (string)
  • propertyPath (string)
  • propertyValue (string)
  • propertyType (string) — optional
  • isPrivateNamespace (boolean) — optional
 Sets a property within a namespace.
  @param session - The session object for the API calls.
  @param namespaceName - The name of the namespace containing the property.
  @param propertyPath - The path to the property within the namespace.
  @param propertyValue - The new value for the property.
  @param propertyType - Optional type of the property value.
  @param isPrivateNamespace - Optional flag to indicate if the namespace is private.
  @returns A promise that resolves to an object containing the success status, command response, and API response.

Copy

copyMvsToUnix

static copyMvsToUnix(session: imperative.Session, sourceDataMember: string, sourceUssPath: string, options?: any) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • sourceDataMember (string)
  • sourceUssPath (string)
  • options (any) — optional
 Copies the MVS datasets and folders PDS and SEQ to Unix System Service.
  @param session - The session to the source system.
  @param sourceUssPath - The path to the source USS file or directory.
  @param sourceDataMember - The data set or member to copy from.
  @returns Promise of IRestApiResponse interface, A promise that resolves when the copy operation is complete.

copyUnixToMvs

static copyUnixToMvs(session: imperative.Session, sourceUssPath: string, destinationDataSet: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • sourceUssPath (string)
  • destinationDataSet (string)
 Copies the Unix System Service file or folder to MVS.
  @param session - The session to the source system.
  @param sourceUssPath - The path to the source USS file or directory.
  @param destinationDataSet - The data set or member to copy to.
  @returns Promise of IRestApiResponse interface , A promise that resolves when the copy operation is complete.

dataSet

static dataSet(session: imperative.Session, { dsn: fromDataSetName, member: fromMemberName }: IDataSet, { dsn: toDataSetName, member: toMemberName }: IDataSet, replace?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • { dsn: fromDataSetName, member: fromMemberName } (IDataSet)
  • { dsn: toDataSetName, member: toMemberName } (IDataSet)
  • replace (boolean) — optional
 Copy the contents of a dataset
  @param session - connection info
  @param fromDataSet - The data set to copy from
  @param toDataSet - The data set to copy to
  @returns A promise that resolves to an IRestApiResponse object indicating the status of the copying

dataSetCrossLPAR

static dataSetCrossLPAR(sourceSession: imperative.Session, { dsn: toDataSetName, member: toMemberName }: IDataSet, options: ICrossLparCopyDatasetOptions, targetSession: imperative.Session, sourceProfile: imperative.IProfile, targetProfile: imperative.IProfile) : Promise<IZosFilesResponse>

Parameters

  • sourceSession (imperative.Session)
  • { dsn: toDataSetName, member: toMemberName } (IDataSet)
  • options (ICrossLparCopyDatasetOptions)
  • targetSession (imperative.Session)
  • sourceProfile (imperative.IProfile)
  • targetProfile (imperative.IProfile)
 Copy the contents of a dataset across LPARs
  @param sourceSession - connection info for source LPAR
  @param toDataSet - The data set to copy to
  @param options - options for the copy operation
  @param targetSession - connection info for target LPAR
  @returns A promise that resolves to an IZosFilesResponse object indicating the status of the copying

getUssExtensionFromInput

static getUssExtensionFromInput(filePath: string) : string

Parameters

  • filePath (string)
 Checks the provided filepath far a extension and returns it.
  @param filepath - The path to the destination USS file or directory
  @returns String, Returns the extension of the file provided within the path.

unixFile

static unixFile(session: imperative.Session, outputPath: string, options?: Omit<object, 'request'>) : Promise<Buffer>

Parameters

  • session (imperative.Session)
  • outputPath (string)
  • options (Omit(object, 'request')) — optional
 Copy the contents of a unix file
  @param session - connection info
  @param outputPath - The path to unix file to copy from
  @param options - options.from - The path to unix file to copy to
  @returns A Promise of a Buffer

ussCrossLPAR

static ussCrossLPAR(sourceSession: imperative.Session, destinationUssPath: string, options: any, targetSession: imperative.Session) : Promise<IRestApiResponse>

Parameters

  • sourceSession (imperative.Session)
  • destinationUssPath (string)
  • options (any)
  • targetSession (imperative.Session)
 Copies a USS file or directory from a source LPAR to a destination LPAR.
  @param sourceSession - The session to the source system.
  @param destinationUssPath - The path to the destination USS file or directory.
  @param options - Additional options for the operation.
  @param targetSession - The session to the target system.
  @returns A promise that resolves to an object containing the success status and a response message.

Create

allocateLike

static allocateLike(session: imperative.Session, dataSetName: string, likeDsName: string, options?: Partial<ICreateDataSetOptions>) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • likeDsName (string)
  • options (Partial(ICreateDataSetOptions)) — optional
 Create a data set like another data set
  @param session - REST API connection info
  @param dataSetName - the name of the data set to create
  @param likeDsName - the name of the data set with attributes to use for new ds
  @param options - additional options for the creation of the data set
  @returns Promise of IRestApiResponse

createMember

static createMember(session: imperative.Session, dataSetName: string, options?: IUploadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • options (IUploadRseOptions) — optional
 Create a member in a dataset
  @param session - RSE connection info
  @param dataSetName - the name of the dataset to create a member in
  @param options - options for the member creation
  @returns Promise of IRestApiResponse

dataSet

static dataSet(session: imperative.Session, cmdType: CreateDataSetTypeEnum | CreateVsamDataSetTypeEnum, dataSetName: string, options?: Partial<ICreateDataSetOptions>) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • cmdType (CreateDataSetTypeEnum | CreateVsamDataSetTypeEnum)
  • dataSetName (string)
  • options (Partial(ICreateDataSetOptions)) — optional
 Create a data set
  @param session - REST API connection info
  @param cmdType - The type of data set we are going to create
  @param dataSetName - the name of the data set to create
  @param options - additional options for the creation of the data set
  @returns Promise of IRestApiResponse

dataSetValidateOptions

static dataSetValidateOptions(options: ICreateDataSetOptions) : void

Parameters

  • options (ICreateDataSetOptions)
 Validate supplied parameters
  @param options - additional options for the creation of the data set

getAttributes

static getAttributes(session: imperative.Session, dsName: string, attrs: IListOptions) : Promise<unknown>

Parameters

  • session (imperative.Session)
  • dsName (string)
  • attrs (IListOptions)
 Get attributes of a dataset
  @param session - RSE connection info
  @param dsName - the name of the dataset
  @param attrs - options for listing dataset attributes
  @returns Promise of attributes

uss

static uss(session: imperative.Session, ussPath: string, type: string, mode?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussPath (string)
  • type (string)
  • mode (string) — optional
 Create a uss file or folder
  @param session - RSE connection info
  @param ussPath - USS path to create file or directory
  @param type - the options.type "f" for file or "d" for directory
  @param mode - Optional, the options.permissions for the permissions for "file" or "directory"
  @returns Promise of IRestApiResponse

Delete

dataSet

static dataSet(session: imperative.Session, dataSetName: string, options?: IDeleteDatasetOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • options (IDeleteDatasetOptions) — optional
 Deletes a non-VSAM data set
  @param session - RSE connection info
  @param dataSetName - The name of the data set to delete
  @param options - Additional options for deletion of the data set
  @returns Promise of IRestApiResponse response indicating the status of the deletion

ussFile

static ussFile(session: imperative.Session, fileName: string, recursive?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • fileName (string)
  • recursive (boolean) — optional
 Deletes a USS file or directory.
  @param session - RSE connection info
  @param fileName - The name of the file or directory to delete
  @param recursive - The indicator to delete directory recursively
  @returns Promise of IRestApiResponse, A response indicating the status of the deletion

DeleteJobs

deleteJob

static deleteJob(session: imperative.Session, jobname: string, jobid: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • jobname (string)
  • jobid (string)
 Cancel and purge a job using job name and job id.
  @param session - connection info
  @param jobname - job name to be translated into parms object
  @param jobid - job id to be translated into parms object
  @returns Promise of IRestApiResponse, promise that resolves when the API call is complete

deleteJobForJob

static deleteJobForJob(session: imperative.Session, job: IJob) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • job (IJob)
 Cancel and purge a job using an IJob object. Alternative version of the delete API accepting an IJob object returned from other APIs such as GetJobs and SubmitJobs.
  @param session - connection info
  @param job - the job that you want to delete
  @returns Promise of IRestApiResponse, promise that resolves when the API call is complete

Download

allMembers

static allMembers(session: imperative.Session, dataSetName: string, profile: imperative.IProfile, options?: IDownloadRseOptions, mappingsFile?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • profile (imperative.IProfile)
  • options (IDownloadRseOptions) — optional
  • mappingsFile (string) — optional
 Retrieve all members from a PDS and save them in your local workspace
  @param session - RSE connection info
  @param dataSetName - contains the data set name
  @param profile - contains the profile information
  @param options - contains the options to be sent
  @param mappingsFile - an absolute path to a conversion mappings file
  @returns IRestApiResponse, A response indicating the outcome of the API

dataSet

static dataSet(session: imperative.Session, dataSetName: string, profile: imperative.IProfile, options?: Partial<IDownloadRseOptions | IDownloadRseSingleOptions>, mappingsFile?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • profile (imperative.IProfile)
  • options (Partial(IDownloadRseOptions | IDownloadRseSingleOptions)) — optional
  • mappingsFile (string) — optional
 Retrieve data sets and/or members contents and save them in your local workspace
  @param session - RSE connection info
  @param dataSetName - contains the data set name
  @param profile - contains the profile information
  @param options - contains the options to be sent
  @param mappingsFile - an absolute path to a conversion mappings file
  @returns IRestApiResponse, A response indicating the outcome of the API

getDatasetContents

static getDatasetContents(session: imperative.Session, datasetName: string, encoding?: string) : Promise<object>

Parameters

  • session (imperative.Session)
  • datasetName (string)
  • encoding (string) — optional
 Retrieves dataset member or sequential dataset contents.
  @param session - rse connection info
  @param datasetname - dataset name

getUnixFileContents

static getUnixFileContents(session: imperative.Session, ussFilePath: string, encoding?: string) : Promise<object>

Parameters

  • session (imperative.Session)
  • ussFilePath (string)
  • encoding (string) — optional
 Retrieves Unix File Contents.
  @param session - rse connection info
  @param ussFilePath - contains the USS file name
  @returns object, The contents of the USS file

ussDir

static ussDir(session: imperative.Session, ussDirPath: string, downloadOptions?: IDownloadOptions, listOptions?: any) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussDirPath (string)
  • downloadOptions (IDownloadOptions) — optional
  • listOptions (any) — optional
 Retrieve USS directory files and save it in your local workspace.
  @param session - rse connection info
  @param ussDirPath - contains the USS directory name
  @param options - contains the file options to be sent
  @param listOptions - additional options for listing files
  @returns IRestApiResponse, A response indicating the outcome of the API
  @throws
  ImperativeError, USS file name must be set
  @throws
  Error When the ZosmfRestClient throws an error

ussFile

static ussFile(session: imperative.Session, ussFileName: string, options?: IDownloadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussFileName (string)
  • options (IDownloadRseOptions) — optional
 Retrieve USS file content and save it in your local workspace.
  @param session - RSE connection info
  @param ussFileName - contains the USS file name and path
  @param options - contains the options to be sent
  @returns IRestApiResponse, A response indicating the outcome of the API

DownloadJobs

downloadAllSpoolContentCommon

static downloadAllSpoolContentCommon(session: imperative.Session, parms: zoweJobs.IDownloadAllSpoolContentParms) : Promise<any>

Parameters

  • session (imperative.Session)
  • parms (zoweJobs.IDownloadAllSpoolContentParms)
 Download all job output (spool content) for a job to a the local directory
  @param session - connection info
  @param parms - parameter object (see IDownloadAllSpoolContentParms for details)
  @returns A promise which will resolve when the download is complete

downloadSpoolContentCommon

static downloadSpoolContentCommon(session: imperative.Session, jobName: string, jobId: string, extension: string, jobFile: zoweJobs.IJobFile, parms: zoweJobs.IDownloadSpoolContentParms) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • jobName (string)
  • jobId (string)
  • extension (string)
  • jobFile (zoweJobs.IJobFile)
  • parms (zoweJobs.IDownloadSpoolContentParms)
 Download spool content to specified directory
  @param session - connection info
  @param jobName - job name
  @param jobId - job id
  @param extension - file extension
  @param jobFile - job file
  @param parms - parm object (see IDownloadSpoolContentParms interface for details
  @returns Promise of IRestApiResponse

getSpoolDownloadFile

static getSpoolDownloadFile(jobFile: zoweJobs.IJobFile, outDir: string, omitJobidDirectory?: boolean, extension?: string) : string

Parameters

  • jobFile (zoweJobs.IJobFile)
  • outDir (string)
  • omitJobidDirectory (boolean) — optional
  • extension (string) — optional
 Get the file where a specified spool file (IJobFile) would be downloaded to
  @param jobFile - the spool file that would be downloaded
  @param outDir - parent output directory you would like to download to
  @param omitJobidDirectory - Optional, if true, the job ID of the jobFile will not be included in the file path
  @param extension - Optional, the extension of the spool files being downloaded
  @returns string, the file path that the spool file would be downloaded to

ErrorHandling

ensureImperativeError

static ensureImperativeError(value: unknown, msg?: string, errCode?: string) : imperative.ImperativeError

Parameters

  • value (unknown)
  • msg (string) — optional
  • errCode (string) — optional
 Ensures or creates an imperative error.
  @param value - The error value, which can be any type.
  @param msg - An optional error message for chaining.
  @param errCode - An optional error code.
  @returns imperative.ImperativeError, The created imperative error.

errorHandler

static errorHandler(value: unknown, msg?: string) : void

Parameters

  • value (unknown)
  • msg (string) — optional
 One-stop method to handle, log, and throw errors.
  @param value - The error value, which can be any type.
  @param msg - An optional error message for chaining or creation.

errorMsgIncludesString

static errorMsgIncludesString(error: unknown, text: string) : boolean

Parameters

  • error (unknown)
  • text (string)
 Checks if a given text is included in the error message.
  @param error - The error to check.
  @param text - The text to search for in the error message.
  @returns boolean, True if the text is found in the error message, false otherwise.

Export

spoolFileToDataset

static spoolFileToDataset(session: imperative.Session, jobName: string, jobId: string, fileId: number, { dsn: toDataSetName, member: toMemberName }: IDataSet, allowTruncation?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • jobName (string)
  • jobId (string)
  • fileId (number)
  • { dsn: toDataSetName, member: toMemberName } (IDataSet)
  • allowTruncation (boolean) — optional
 Exports a spool file to a dataset.
  @param session - The session object used for communication with the IBM Z system.
  @param jobName - The name of the job.
  @param jobId - The ID of the job.
  @param fileId - The ID of the spool file.
  @param dataset - The dataset parameters.
  @param allowTruncation - Optional parameter to allow truncation of the spool file.
  @returns A promise that resolves to an object containing the success status, command response, and API response.

truncationdetected

static truncationdetected(session: imperative.Session, jobname: string, jobid: string, spoolFileId: number, lrecl: number) : Promise<boolean>

Parameters

  • session (imperative.Session)
  • jobname (string)
  • jobid (string)
  • spoolFileId (number)
  • lrecl (number)
 Checks if truncation is detected in the spool file.
  @param session - The session object used for communication with the IBM Z system.
  @param jobname - The name of the job.
  @param jobid - The ID of the job.
  @param spoolFileId - The ID of the spool file.
  @param lrecl - The logical record length.
  @returns A promise that resolves to a boolean indicating if truncation was detected.

Get

dataSet

static dataSet(session: imperative.Session, dataSetName: string, options: Partial<IGetOptions>) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • options (Partial(IGetOptions))
 Retrieve data sets content
  @param session - RSE connection info
  @param dataSetName - contains the data set name
  @param options - contains the options to be sent
  @returns Promise of IRestApiResponse, Promise that resolves to the data set contents

getFileTag

static getFileTag(session: imperative.Session, USSFileName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • USSFileName (string)
 Retrieve file tag from USS
  @param session - RSE connection info
  @param USSFileName - contains the uss file path
  @returns Promise of IRestApiResponse, Promise that resolves to the tag associated to the USS file

GetContent

dataSet

static dataSet(session: imperative.Session, dataSetName: string, destination: string, options?: IDownloadRseOptions | IDownloadRseSingleOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • destination (string)
  • options (IDownloadRseOptions | IDownloadRseSingleOptions) — optional
 Retrieve Dataset Member content to save it in your local workspace.
  @param session - RSE connection info
  @param dataSetName - contains the dataset name
  @param destination - location to save the file
  @param options - contains the options to be sent
  @returns Promise of IRestApiResponse, A response indicating the outcome of the API

jobOutput

static jobOutput(session: imperative.Session, jobFile: zoweJobs.IJobFile, destination: string, parms?: zoweJobs.IDownloadSpoolContentParms) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • jobFile (zoweJobs.IJobFile)
  • destination (string)
  • parms (zoweJobs.IDownloadSpoolContentParms) — optional
 Retrieve Job Spool content to save it in your local workspace.
  @param session - RSE connection info
  @param jobFile - job file
  @param destination - location to save the file
  @param options - contains the options to be sent
  @returns Promise of IRestApiResponse, A response indicating the outcome of the API

ussFile

static ussFile(session: imperative.Session, ussFileName: string, destination: string, options?: Partial<IDownloadRseOptions>) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussFileName (string)
  • destination (string)
  • options (Partial(IDownloadRseOptions)) — optional
 Retrieve USS file content to save it in your local workspace.
  @param session - RSE connection info
  @param ussFileName - contains the USS file name
  @param destination - location to save the file
  @param options - contains the options to be sent
  @returns Promise of IRestApiResponse, A response indicating the outcome of the API

GetJobs

getJclForJob

static getJclForJob(session: imperative.Session, job: IJob) : Promise<string>

Parameters

  • session (imperative.Session)
  • job (IJob)
 Get JCL from a job. Alternate version of the API that accepts an IJob object returned by other APIs such as SubmitJobs.
  @param session - RSE connection info
  @param job - the job for which you would like to retrieve JCL
  @returns string, promise that resolves to JCL content

getJob

static getJob(session: imperative.Session, jobid: string, attributes?: boolean) : Promise<IJob>

Parameters

  • session (imperative.Session)
  • jobid (string)
  • attributes (boolean) — optional
 Get a single job object from an input job id
  @param session - RSE connection info
  @param jobid - the job ID for the job for which you want to get status
  @param attributes - query more job attributes when it is set to true
  @returns IJob

getJobs

static getJobs(session: imperative.Session, options?: IGetJobsParms) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • options (IGetJobsParms) — optional
 Get jobs (defaults to the user ID of the session as owner)
  @param session - RSE connection info
  @param options -
  @returns IRestApiResponse, promise that resolves to an array of IJob objects (matching jobs)

getJobsByOwner

static getJobsByOwner(session: imperative.Session, owner: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • owner (string)
 Get jobs that are owned by a certain user or pattern of users
  @param session - RSE connection info
  @param owner - owner for which to get jobs. Supports wildcard e.g. IBMUreturns jobs owned by all users whose ID beings with "IBMU"
  @returns IRestApiResponse, promise that resolves to include an array of IJob objects (matching jobs)

getJobsByOwnerAndPrefix

static getJobsByOwnerAndPrefix(session: imperative.Session, options?: IGetJobsParms) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • options (IGetJobsParms) — optional
 Get a list of jobs that match an owner and prefix
  @param session - RSE connection info
  @param options -
  @returns IRestApiResponse

getJobsByParameters

static getJobsByParameters(session: imperative.Session, options?: IGetJobsParms) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • options (IGetJobsParms) — optional
 Get a list of jobs that match parameters
  @param session - RSE connection info
  @param options -
  @returns IRestApiResponse

getJobsByPrefix

static getJobsByPrefix(session: imperative.Session, prefix: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • prefix (string)
 Get jobs that match a job name preixl Defaults to jobs owned by the user ID in the session.
  @param session - connection info
  @param prefix - job name prefix for which to list jobs. Supports wildcard e.g. JOBNMreturns jobs with names starting with "JOBNM"
  @returns IRestApiResponse, promise that resolves to include an array of IJob objects (matching jobs)

getSpoolContent

static getSpoolContent(session: imperative.Session, jobFile: IJobFile) : Promise<string>

Parameters

  • session (imperative.Session)
  • jobFile (IJobFile)
 Get spool content from a job (keeping naming convention patter with this duplication function).
  @param session - RSE connection info
  @param jobFile - the spool file for which you want to retrieve the content
  @returns string, promise that resolves to the spool content

getSpoolContentById

static getSpoolContentById(session: imperative.Session, jobname: string, jobid: string, spoolId: number, encoding?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • jobname (string)
  • jobid (string)
  • spoolId (number)
  • encoding (string) — optional
 Get spool content from a job using the job name, job ID, and spool ID number from RSE
  @param session - RSE connection info
  @param jobname - the job name for the job containing the spool content
  @param jobid - the job id for the job containing the spool content
  @param spoolId - id number assigned by the jobs api that identifies the particular job spool file (DD)
  @param encoding - host encoding
  @returns IRestApiResponse, promise that resolves to the spool content

getSpoolContentCommon

static getSpoolContentCommon(session: imperative.Session, jobFile: IJobFile) : Promise<string>

Parameters

  • session (imperative.Session)
  • jobFile (IJobFile)
 Get spool content from a job.
  @param session - RSE connection info
  @param jobFile - the spool file for which you want to retrieve the content
  @returns string, promise that resolves to the spool content

getSpoolFiles

static getSpoolFiles(session: imperative.Session, jobName: string, jobId: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • jobName (string)
  • jobId (string)
 Get a list of all spool files for a job.
  @param session - RSE connection info
  @param jobname - the job name for the job for which you want to get a list of spool files
  @param jobid - the job ID for the job for which you want to get a list of spool files
  @returns IRestApiResponse, promise that resolves to include an array of IJobFile objects

getSpoolFilesCommon

static getSpoolFilesCommon(session: imperative.Session, parms: ICommonJobParms) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • parms (ICommonJobParms)
 Get a list of all job spool files for a job.
  @param session - RSE connection info
  @param parms - parm object (see for details)
  @returns IRestApiResponse, promise that resolves to an array of IJobFile objectsl

getSpoolFilesForJob

static getSpoolFilesForJob(session: imperative.Session, job: IJob) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • job (IJob)
 Get a list of all job spool files for a job Alternate version of the API that accepts an IJob object returned by other APIs such as SubmitJobs.
  @param session - RSE connection info
  @param job - the job for which you would like to get a list of job spool files
  @returns IRestApiResponse, promise that resolves to include an array of IJobFile objects

getStatusCommon

static getStatusCommon(session: imperative.Session, parms: IMonitorJobWaitForParms) : Promise<object>

Parameters

  • session (imperative.Session)
  • parms (IMonitorJobWaitForParms)
 Get the status and other details (e.g. owner, return code) for a job
  @param session - RSE connection info
  @param parms - parm object (see ICommonJobParms interface for details)
  @returns IJob, promise that resolves to an IJob object representing the job

getStepInfoOfJob

static getStepInfoOfJob(session: imperative.Session, jobname: string, jobid: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • jobname (string)
  • jobid (string)
 Get the step information of a job.
  @param session - RSE connection info
  @param jobname - name of the job
  @param jobid - jobid of the job
  @returns IRestApiResponse, promise that resolves to step information

HeadApis

mvsFileHeaders

static mvsFileHeaders(session: imperative.Session, fileName: string, options: IDownloadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • fileName (string)
  • options (IDownloadRseOptions)
 Asynchronously retrieves the headers of an MVS file.
  @param session - The session object for the REST API.
  @param fileName - The name of the file.
  @param options - Options for the download request.
  @returns Promise of IRestApiResponse, A promise that resolves to an object containing the API response.

mvsGetDataSetCount

static mvsGetDataSetCount(session: imperative.Session, dsName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dsName (string)
 Public method to perform a HEAD request to get the number of data sets matching the provided filter.
  @param session - The session object for the REST API.
  @param dsName - The name of the dataset for which the call is made.
  @returns Promise of IRestApiResponse interface, A promise that returns the total-count of the data sets matching the filter.

unixFileHeader

static unixFileHeader(session: imperative.Session, fileName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • fileName (string)
 Asynchronously retrieves the headers of a UNIX file.
  @param session - The session object for the REST API.
  @param fileName - The name of the file.
  @returns Promise of IRestApiResponse, A promise that resolves to an object containing the API response.

HMigrate

dataSet

static dataSet(session: imperative.Session, dataSetName: string, options?: Partial<IMigrateOptions>) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • options (Partial(IMigrateOptions)) — optional
 Migrate a data set
  @param session - RSE connection info
  @param dataSetName - The name of the data set to recall
  @returns Promise of IRestApiResponse, A response indicating the status of the recalling

HRecall

dataSet

static dataSet(session: imperative.Session, dataSetName: string, options?: Partial<IRecallOptions>) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • options (Partial(IRecallOptions)) — optional
 Recall a migrated data set
  @param session - RSE connection info
  @param dataSetName - The name of the data set to recall
  @param options - If true then the function waits for completion of the request. If false (default) the request is queued.
  @returns Promise of IZosFilesResponse, A response indicating the status of the recalling

IssueCommand

consoleCommand

static consoleCommand(session: imperative.Session, command: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • command (string)
 Issues a console command to the z/OS system.
  @param session - The session object for authentication and communication.
  @param command - The console command to execute.
  @returns A promise that resolves to an object containing the command response and API response.

tsoCommand

static tsoCommand(session: imperative.Session, command: string, shellId?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • command (string)
  • shellId (string) — optional
 Issues a TSO command to the z/OS system.
  @param session - The session object for authentication and communication.
  @param command - The TSO command to execute.
  @param shellId - The shell ID for the command (optional).
  @returns IRestApiResponse, A promise that resolves to an object containing the command response and API response.

tsoShellCommand

static tsoShellCommand(session: imperative.Session, commandText: string, shellId: string, stdoutHandler: (data: Buffer | string) => void) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • commandText (string)
  • shellId (string)
  • stdoutHandler ((data: Buffer | string) =) void)
 Issues a TSO shell command to the z/OS system and streams the output.
  @param session - The session object for authentication and communication.
  @param commandText - The TSO shell command to execute.
  @param shellId - The shell ID for the command.
  @param stdoutHandler - A callback function to handle the command output.
  @returns IRestApiResponse, A promise that resolves to an object containing the command response and API response.

unixCommand

static unixCommand(session: imperative.Session, commandText: string, cwd: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • commandText (string)
  • cwd (string)
 Issues a Unix command to the z/OS system.
  @param session - The session object for authentication and communication.
  @param commandText - The Unix command to execute.
  @param cwd - The current working directory for the command.
  @returns A promise that resolves to an object containing the command response and API response.

unixLongRunningCommand

static unixLongRunningCommand(session: imperative.Session, commandText: string, cwd: string, callback: (res: IncomingMessage) => void) : ClientRequest

Parameters

  • session (imperative.Session)
  • commandText (string)
  • cwd (string)
  • callback ((res: IncomingMessage) =) void)
 Issues a long-running Unix command to the z/OS system.
  @param session - The session object for authentication and communication.
  @param commandText - The Unix command to execute.
  @param cwd - The current working directory for the command.
  @param callback - A callback function to handle the command output.
  @returns ClientRequest, A request object for the long-running command.

unixLongRunningCommandPost

static unixLongRunningCommandPost(session: imperative.Session, commandText: string, cwd: string, callback: (res: IncomingMessage) => void) : ClientRequest

Parameters

  • session (imperative.Session)
  • commandText (string)
  • cwd (string)
  • callback ((res: IncomingMessage) =) void)
 Issues a long-running Unix command to the z/OS system using POST method.
  @param session - The session object for authentication and communication.
  @param commandText - The Unix command to execute.
  @param cwd - The current working directory for the command.
  @param callback - A callback function to handle the command output.
  @returns ClientRequest, A request object for the long-running command.

unixShellCommand

static unixShellCommand(session: imperative.Session, commandText: string, cwd: string, env: string, stdoutHandler: (data: Buffer | string) => void) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • commandText (string)
  • cwd (string)
  • env (string)
  • stdoutHandler ((data: Buffer | string) =) void)
 Issues a Unix shell command to the z/OS system and streams the output.
  @param session - The session object for authentication and communication.
  @param commandText - The Unix shell command to execute.
  @param cwd - The current working directory for the command.
  @param env - The environment variables for the command (optional).
  @param stdoutHandler - A callback function to handle the command output.
  @returns IRestApiResponse, A promise that resolves to an object containing the command response and API response.

unixShellCommandPost

static unixShellCommandPost(session: imperative.Session, commandText: string, cwd: string, env?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • commandText (string)
  • cwd (string)
  • env (string) — optional
 Issues a Unix shell command to the z/OS system using POST method.
  @param session - The session object for authentication and communication.
  @param commandText - The Unix shell command to execute.
  @param cwd - The current working directory for the command.
  @param env - The environment variables for the command (optional).
  @returns A promise that resolves to an object containing the command response and API response.

List

allMembers

static allMembers(session: imperative.Session, dataSetName: string, options?: IListOptions, rangeOptions?: Partial<IRseMemberRangingOptions>) : Promise<IZosFilesResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • options (IListOptions) — optional
  • rangeOptions (Partial(IRseMemberRangingOptions)) — optional
 Retrieve a list of data set members.
  @param session - The session object used for REST API calls.
  @param dataSetName - The name of the data set.
  @param options - Optional options for the REST API call.
  @param rangeOptions - Optional range options for the REST API call.
  @returns IZosFilesResponse, A promise that resolves to an object containing the success status, command response, and API response.

dataSet

static dataSet(session: imperative.Session, filter: string, options?: IListOptions, rangeOptions?: Partial<IRseMemberRangingOptions>) : Promise<IZosFilesResponse>

Parameters

  • session (imperative.Session)
  • filter (string)
  • options (IListOptions) — optional
  • rangeOptions (Partial(IRseMemberRangingOptions)) — optional
 Retrieve a list of data sets for a filter.
  @param session - The session object used for REST API calls.
  @param filter - The filter for a dataset query.
  @param options - Optional options for the REST API call.
  @param rangeOptions - Optional range options for the REST API call.
  @returns IZosFilesResponse, A promise that resolves to an object containing the success status, command response, and API response.

dataSetsMatchingPattern

static dataSetsMatchingPattern(session: imperative.Session, patterns: string[], options?: IDsmListOptions, rangeOptions?: Partial<IRseMemberRangingOptions>) : Promise<IZosFilesResponse>

Parameters

  • session (imperative.Session)
  • patterns (string[])
  • options (IDsmListOptions) — optional
  • rangeOptions (Partial(IRseMemberRangingOptions)) — optional
 List data sets that match a DSLEVEL pattern
  @param session - rse connection info
  @param patterns - Data set patterns to include
  @param options - Contains options for the rse request, Optional
  @param rangeOptions - Optional range options for the REST API call.
  @returns IZosFilesResponse, a Promise of a rse list responses for each data set

fileList

static fileList(session: imperative.Session, path: string, showAdditionalAttributes?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • path (string)
  • showAdditionalAttributes (boolean) — optional
 Retrieve a list of files from USS.
  @param session - The session object used for REST API calls.
  @param path - The path of the files to retrieve.
  @param showAdditionalAttributes - Optional flag to show additional attributes.
  @returns IRestApiResponse, A promise that resolves to an object containing the success status, command response, and API response.

getDataSetCount

static getDataSetCount(session: imperative.Session, dataSetPatterns: string[]) : Promise<IRseDataSetCount>

Parameters

  • session (imperative.Session)
  • dataSetPatterns (string[])
 Retrieve the count of data sets matching the provided pattern.
  @param session - Current session
  @param dataSetPatterns - List of name of datasets.
  @returns Promise of IRseDataSetCount interface, A promise that resolves to an object containing the count and the lastItem and the api response from teh last pattern in teh dataSetPatterns.

getMvsDataSetCountInternal

static getMvsDataSetCountInternal(session: imperative.Session, dataSetPatterns: string[]) : Promise<IDataSetCount>

Parameters

  • session (imperative.Session)
  • dataSetPatterns (string[])
 Retrieve the total count of MVS data sets matching the provided patterns.
  This method iterates over multiple dataset name patterns and determines the total number of matching datasets. When supported by the server API version, it uses the optimized HEAD request to obtain the count; otherwise, it falls back to listing datasets and calculating the count manually.
  The method also determines the name of the last dataset encountered across all provided patterns.
  @param session - Current session
  @param dataSetPatterns - List of dataset name patterns
  @returns Promise of IDataSetCount - A promise that resolves to an object containing the total count of datasets and the name of the last dataset.

rangeOffSetCounter

static rangeOffSetCounter(maxLength: number, rangeNameOffset: string) : number

Parameters

  • maxLength (number)
  • rangeNameOffset (string)
 Return the offset counter for the given range
  @param maxLength - pagination limit from the vscode setting
  @param rangeNameOffset - rangeNameOffset from the options
  @returns number, rangeOffSetValue for the. rangeNameOffset

Lock

getLockInfoMembers

static getLockInfoMembers(session: imperative.Session, dataSetName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
 Retrieve the lock info of all locks hold on members of a partition dataset.
  @param session - connection info
  @param dataSetName - The dataset name that needs to be checked
  @returns Promise of IRestApiResponse, Standard CLI reposonse object

getMVSLockOwner

static getMVSLockOwner(session: imperative.Session, dataSetName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
 Gets the owner user id of the exclusive lock acquired on a sequential dataset or a member of a partition dataset.
  @param session - connection info
  @param dataSetName - The dataset name that needs to be checked
  @returns Promise of IRestApiResponse, Standard CLI reposonse object

removeLock

static removeLock(session: imperative.Session, dataSetName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
 Release the exclusive lock acquired on a sequential dataset or a member of a partition dataset.
  @param session - connection info
  @param dataSetName - The dataset name that needs to be checked
  @returns Promise of IRestApiResponse, Standard CLI reposonse object

setLock

static setLock(session: imperative.Session, dataSetName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
 Acquires an exclusive lock on asequential dataset or a member of a partitioned dataset.
  @param session - connection info
  @param dataSetName - The dataset name that needs to be checked
  @returns Promise of IRestApiResponse, Standard CLI reposonse object

MonitorJobs

waitForJobOutputStatus

static waitForJobOutputStatus(session: imperative.Session, job: IJob) : Promise<IJob>

Parameters

  • session (imperative.Session)
  • job (IJob)
 Given an IJob (has jobname/jobid), waits for the status of the job to be "OUTPUT". This API will poll for the OUTPUT status once every 3 seconds for 100 attempts. If the polling interval/duration is NOT sufficient, use "waitForStatusCommon" to adjust.
  See JSDoc for "waitForStatusCommon" for full details on polling and other logic.
  @param session - RSE client session
  @param job - the z/OS job to wait for (see RSE Jobs APIs for details)
  @returns IJob, the promise to be fulfilled with IJob object (or rejected with an ImperativeError)

waitForOutputStatus

static waitForOutputStatus(session: imperative.Session, jobName: string, jobId: string) : Promise<IJob>

Parameters

  • session (imperative.Session)
  • jobName (string)
  • jobId (string)
 Given the jobname/jobid, waits for the status of the job to be "OUTPUT". This API will poll for the OUTPUT status once every 3 seconds for 100 attempts. If the polling interval/duration is NOT sufficient, use "waitForStatusCommon" to adjust.
  See JSDoc for "waitForStatusCommon" for full details on polling and other logic.
  @param session - RSE client session
  @param jobName - the z/OS jobname of the job to wait for output status (see RSE Jobs APIs for details)
  @param jobId - the z/OS jobid of the job to wait for output status (see RSE Jobs APIS for details)
  @returns IJob, the promise to be fulfilled with IJob object (or rejected with an ImperativeError)

Move

uss

static uss(session: imperative.Session, ussPath: string, newUSSPath: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussPath (string)
  • newUSSPath (string)
 Move USS file
  @param session - connection info
  @param ussPath - The uss file or directory you are renaming
  @param newUSSPath - The new name of the uss file or directory
  @returns Promise of IRestApiResponse, Standard CLI reposonse object

ProfileSession

getProfileSession

static getProfileSession(profile: imperative.IProfileLoaded) : imperative.Session

Parameters

  • profile (imperative.IProfileLoaded)
 Creates a session for the given profile. If the profile has a valid token, it uses it to create the session. If the token is invalid or expired, it uses the profile's credentials. If there's no token, it uses the credentials directly.
  @param profile - The profile object containing user information and token details.
  @returns imperative.Session, The created session.
  @throws
  imperative.ImperativeError, If the token is expired.

ProfileUtils

getCmdArgs

static getCmdArgs(profile: imperative.IProfile) : imperative.ICommandArguments

Parameters

  • profile (imperative.IProfile)
 Converts an IProfile object to ICommandArguments.
  @param profile - The IProfile object to convert.
  @returns imperative.ICommandArguments, The converted ICommandArguments object.

getConfigLocation

static getConfigLocation() : string
 Retrieves the location of the Zowe team configuration file.
  @returns string, The location of the configuration.

getDefaultRseProfile

static getDefaultRseProfile() : Promise<imperative.IProfileLoaded>
 Retrieves the default RSE profile.
  @returns imperative.IProfileLoaded, A promise that resolves to an IProfileLoaded object.

getProfileInfo

static getProfileInfo() : Promise<imperative.ProfileInfo>
 Retrieves profile information.
  @returns imperative.ProfileInfo, A promise that resolves to a ProfileInfo object.

getProfileMeta

static getProfileMeta() : Promise<imperative.ICommandProfileTypeConfiguration[]>
 Retrieves all command profile type configurations.
  @returns imperative.ICommandProfileTypeConfiguration[], A promise that resolves to an array of ICommandProfileTypeConfiguration objects.

getProfileName

static getProfileName(commandParameters: imperative.IHandlerParameters) : Promise<string>

Parameters

  • commandParameters (imperative.IHandlerParameters)
 Retrieves the name of the RSE profile to use.
  @param commandParameters - The command parameters.
  @returns string, A promise that resolves to the name of the RSE profile.

getSecurePropsForProfile

static getSecurePropsForProfile(profileName: string) : Promise<string[]>

Parameters

  • profileName (string)
 Retrieves secure properties for a given profile.
  @param profileName - The name of the profile.
  @returns string[], A promise that resolves to an array of secure property names.

isBaseUsed

static isBaseUsed(profile: imperative.IProfileLoaded) : Promise<boolean>

Parameters

  • profile (imperative.IProfileLoaded)
 Checks if the provided profile uses the 'base' profile.
  @param profile - The IProfileLoaded object to check.
  @returns boolean, A promise that resolves to a boolean indicating if the 'base' profile is used.

isProfileLayerGlobal

static isProfileLayerGlobal(profileName: string) : Promise<boolean>

Parameters

  • profileName (string)
 Identifies the layer (global or project) where a specific profile is defined.
  @param profileName - The name of the profile.
  @param profileType - The type of the profile.
  @returns

setWorkingDir

static setWorkingDir(dir: string) : void

Parameters

  • dir (string)
 Sets the working directory for profile operations.
  @param dir - The directory to set as the working directory.

updateProfileFilePassword

static updateProfileFilePassword(profName: string, profile: imperative.IProfile) : Promise<void>

Parameters

  • profName (string)
  • profile (imperative.IProfile)
 Updates the password in the profile file.
  @param profName - The name of the profile to update.
  @param profile - The IProfile object containing the new password.
  @returns void, A promise that resolves to void.

Rename

dataSet

static dataSet(session: imperative.Session, dataSetName: string, newName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • newName (string)
 Rename a Data Set file
  @param session - connection info
  @param dataSetName - The mvs data set or member you are renaming
  @param newName - The new name of the mvs data set or member
  @returns Promise of IRestApiResponse, Standard CLI reposonse object

uss

static uss(session: imperative.Session, ussPath: string, newName: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussPath (string)
  • newName (string)
 Rename a USS file
  @param session - connection info
  @param ussPath - The uss file or directory you are renaming
  @param newName - The new name of the uss file or directory
  @returns Promise of IRestApiResponse, Standard CLI reposonse object

RestUtils

chtag

static chtag(session: imperative.Session, ussFileName: string, type: Tag, codeset?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussFileName (string)
  • type (Tag)
  • codeset (string) — optional
 Changes the tag attributes associated with a file.
  @param session - RSE connection info
  @param ussFileName - name of the USS File
  @param type - enum of chtag type of Test, Binary or Mixed
  @param codeset - optional string describing codeset e.g. IBM-1047
  @returns Promise of IRestApiResponse, - Promise that resolves to response object

postUSSPayload

static postUSSPayload(session: imperative.Session, USSFileName: string, payload: any) : Promise<Buffer>

Parameters

  • session (imperative.Session)
  • USSFileName (string)
  • payload (any)
 Sends a POST request to copy or move a USS file.
  @param session - RSE connection info
  @param USSFileName - name of the USS File
  @param payload - contains the request payload options
  @returns Promise of Buffer that resolves to json information

putUSSPayload

static putUSSPayload(session: imperative.Session, USSFileName: string, payload: any) : Promise<Buffer>

Parameters

  • session (imperative.Session)
  • USSFileName (string)
  • payload (any)
 Sends a PUT request to update a USS file's attributes.
  @param session - RSE connection info
  @param USSFileName - name of the USS File
  @param payload - contains the request payload options
  @returns Promise of Buffer that resolves to json information

setRequestOptions

static setRequestOptions(session: imperative.Session, endpoint: string, method: string, reqHeaders: any[]) : https.RequestOptions

Parameters

  • session (imperative.Session)
  • endpoint (string)
  • method (string)
  • reqHeaders (any[])
 Sets the request options for an HTTPS request.
  @param session - RSE connection info
  @param endpoint - the endpoint to send the request to
  @param method - the HTTP method (GET, POST, PUT, DELETE, etc.)
  @param reqHeaders - the request headers
  @returns https.RequestOptions, the options for the HTTPS request

RseHeaders

setMvsHeaders

static setMvsHeaders(session: imperative.Session, options?: IUploadRseOptions, streaming?: boolean) : imperative.IHeaderContent[]

Parameters

  • session (imperative.Session)
  • options (IUploadRseOptions) — optional
  • streaming (boolean) — optional
 Sets headers for MVS file upload.
  @param session - The session object.
  @param options - The options for the upload.
  @param streaming - Whether the upload is streaming or not.
  @returns imperative.IHeaderContent[], An array of header content objects.

setUnixFileHeaders

static setUnixFileHeaders(session: imperative.Session, options?: IUploadRseOptions, streaming?: boolean) : imperative.IHeaderContent[]

Parameters

  • session (imperative.Session)
  • options (IUploadRseOptions) — optional
  • streaming (boolean) — optional
 Sets headers for Unix file upload.
  @param session - The session object.
  @param options - The options for the upload.
  @param streaming - Whether the upload is streaming or not.
  @returns imperative.IHeaderContent[], An array of header content objects.

RseRestApiCommon

getProfileTypeName

getProfileTypeName() : string
 Returns the profile type name for RSE.
  @returns string, The profile type name, which is 'rse'.

getProfileTypeName

static getProfileTypeName() : string
 Returns the profile type name for RSE.
  @returns string, The profile type name, which is 'rse'.

getSession

getSession(profile?: imperative.IProfileLoaded) : imperative.Session

Parameters

  • profile (imperative.IProfileLoaded) — optional
 Retrieves the session for the given profile.
  @param profile - The profile to get the session for.
  @returns imperative.Session, The session.

getSessionFromCommandArgument

getSessionFromCommandArgument(cmdArgs: imperative.ICommandArguments) : imperative.Session

Parameters

  • cmdArgs (imperative.ICommandArguments)
 Creates a session from command arguments.
  @param cmdArgs - The command arguments.
  @returns imperative.Session, The created session.

getStatus

getStatus(validateProfile?: imperative.IProfileLoaded, profileType?: string) : Promise<string>

Parameters

  • validateProfile (imperative.IProfileLoaded) — optional
  • profileType (string) — optional
 Gets the status of the server.
  @param validateProfile - The profile to validate.
  @param profileType - The profile type.
  @returns string, A promise that resolves with the session status ('active', 'inactive', or 'unverified').

getTokenTypeName

getTokenTypeName() : string
 Returns the token type name.
  @returns string, The token type name, which is either 'APIML' or 'JWT'.

login

login(session: imperative.Session) : Promise<string>

Parameters

  • session (imperative.Session)
 Logs in to the RSE server or the Zowe API ML determined by the basePath.
  @param session - The session to use for login.
  @returns string, A promise that resolves with the token value.

logout

logout(session: imperative.Session) : Promise<void>

Parameters

  • session (imperative.Session)
 Logs out from the RSE server or the Zowe API ML determined by the basePath.
  @param session - The session to use for logout.

RseRestClassificationScanApi

registerApi

static registerApi(apiRegister: IRegisterClient) : void

Parameters

  • apiRegister (IRegisterClient)
 Static function that is used to register the RSE API with a ZoweExplorerApi.IApiRegisterClient instance.
  @param apiRegister -

scanContainer

scanContainer(containerPath: string, resultsHandler: (data: string) => void, hostEncoding?: string, filenameFilter?: string) : Promise<IRestApiResponse>

Parameters

  • containerPath (string)
  • resultsHandler ((data: string) =) void)
  • hostEncoding (string) — optional
  • filenameFilter (string) — optional
 Scan the container specified by the containerPath string.
  @param containerPath - The path of the container to scan.
  @param resultsHandler - A function to collect the results of the scan.
  @param hostEncoding - Optional host encoding if different from the default.
  @param filenameFilter - Optional filter for determining which files will be scanned.
  @returns IRestApiResponse, A promise that resolves to the scan results.

scanContent

scanContent(content: string) : Promise<IRestApiResponse>

Parameters

  • content (string)
 Scan the specified contents.
  @param content - The content of a source file to scan.
  @returns IRestApiResponse, A promise that resolves to the scan results.

scanResource

scanResource(resPath: string) : Promise<IRestApiResponse>

Parameters

  • resPath (string)
 Scan the resource specified by the resPath string.
  @param resPath - The path of the file, SEQ or PDS member to scan.
  @returns IRestApiResponse, A promise that resolves to the scan results.

RseRestClient

appendHeaders

appendHeaders(headers: any[] | undefined) : any[]

Parameters

  • headers (any[] | undefined)
 Appends Zowe REST specific headers to the caller's headers.
  @param headers - The current header array.
  @returns any[], The modified header array.

getExpectBufferAndEtag

static getExpectBufferAndEtag(session: imperative.Session, resource: string, reqHeaders?: any[]) : Promise<IStringWithEtag>

Parameters

  • session (imperative.Session)
  • resource (string)
  • reqHeaders (any[]) — optional
 Retrieves data from the specified resource and returns an object containing the data and ETag.
  @param session - The session object for authentication.
  @param resource - The resource URL to make the GET request to.
  @param reqHeaders - Optional request headers.
  @returns A Promise that resolves to an object containing the data and ETag.

getExpectJSONWithHeaders

static getExpectJSONWithHeaders(session: imperative.Session, resource: string, reqHeaders?: any[]) : Promise<IRestResponseWithHeaders>

Parameters

  • session (imperative.Session)
  • resource (string)
  • reqHeaders (any[]) — optional
 Retrieves data from the specified resource and returns an object containing the JSON data and response headers.
  @param session - The session object for authentication.
  @param resource - The resource URL to make the GET request to.
  @param reqHeaders - Optional request headers.
  @returns A Promise that resolves to an object containing the JSON data and response headers.

performRest

performRest(resource: string, request: imperative.HTTP_VERB, reqHeaders?: any[], writeData?: any) : Promise<string>

Parameters

  • resource (string)
  • request (imperative.HTTP_VERB)
  • reqHeaders (any[]) — optional
  • writeData (any) — optional
 Overrides the performRest method to append hostname, port, and plex headers to all IMS requests.
  @param resource - The resource URL to make the request to.
  @param request - The HTTP request method (GET, POST, PUT, DELETE).
  @param reqHeaders - Optional request headers.
  @param writeData - Optional data to write in the request body.
  @returns A Promise that resolves to the response from the server.

postExpectAuthToken

static postExpectAuthToken(session: imperative.Session, resource: string, payload: any, reqHeaders?: any[]) : Promise<IAuthorizationToken>

Parameters

  • session (imperative.Session)
  • resource (string)
  • payload (any)
  • reqHeaders (any[]) — optional
 Sends a payload for authentication and returns an object containing the authorization token and other headers.
  @param session - The session object for authentication.
  @param resource - The resource URL to make the POST request to.
  @param payload - The payload to send in the request body.
  @param reqHeaders - Optional request headers.
  @returns A Promise that resolves to an object containing the authorization token and other headers.

postExpectNewAuthToken

static postExpectNewAuthToken(session: imperative.Session, resource: string, reqHeaders?: any[]) : Promise<IAuthorizationToken>

Parameters

  • session (imperative.Session)
  • resource (string)
  • reqHeaders (any[]) — optional
 Sends a request for a new authentication token and returns an object containing the authorization token and other headers.
  @param session - The session object for authentication.
  @param resource - The resource URL to make the POST request to.
  @param reqHeaders - Optional request headers.
  @returns A Promise that resolves to an object containing the authorization token and other headers.

putExpectStringAndEtag

static putExpectStringAndEtag(session: imperative.Session, resource: string, data: any, reqHeaders?: any[]) : Promise<IStringWithEtag>

Parameters

  • session (imperative.Session)
  • resource (string)
  • data (any)
  • reqHeaders (any[]) — optional
 Sends data to the specified resource and returns an object containing the response and ETag.
  @param session - The session object for authentication.
  @param resource - The resource URL to make the PUT request to.
  @param data - The data to send in the request body.
  @param reqHeaders - Optional request headers.
  @returns A Promise that resolves to an object containing the response and ETag.

RseRestCommandApi

issueMvsCommand

issueMvsCommand(command: string) : Promise<IConsoleResponse>

Parameters

  • command (string)
 Issues a MVS Command and returns a Console Command API response. NOTE: Not implemented by RSE API yet
  @param command - The MVS command to be executed.
  @returns IConsoleResponse, A promise that resolves to an IConsoleResponse object.

issueTsoCommandWithParms

issueTsoCommandWithParms(command: string, parms?: IStartTsoParms) : Promise<IIssueResponse>

Parameters

  • command (string)
  • parms (IStartTsoParms) — optional
 Issues a TSO Command and returns a API response.
  @param command - The TSO command to be executed.
  @param parms - Optional parameters for the TSO command.
  @returns IIssueResponse, A promise that resolves to an IIssueResponse object.

issueUnixCommand

issueUnixCommand(command: string, cwd: string, sshSession?: SshSession) : Promise<string>

Parameters

  • command (string)
  • cwd (string)
  • sshSession (SshSession) — optional
 Issues a Unix Command and returns a Console Command API response.
  @param command - The Unix command to be executed.
  @param cwd - The current working directory for the Unix command.
  @param sshSession - Optional SSH session for the Unix command.
  @returns string, A promise that resolves to a string containing the command output.

registerApi

static registerApi(apiRegister: IRegisterClient) : void

Parameters

  • apiRegister (IRegisterClient)
 Static function that is used to register the RSE API with a ZoweExplorerApi.IApiRegisterClient instance.
  @param apiRegister - An instance of IApiRegisterClient.

RseRestJesApi

cancelJob

cancelJob(job: zoweJobs.IJob) : Promise<boolean>

Parameters

  • job (zoweJobs.IJob)
 Cancels a running job.
  @param job - The job object containing job details.
  @returns boolean, A promise that resolves to a boolean indicating success.

deleteJob

deleteJob(jobname: string, jobid: string) : Promise<void>

Parameters

  • jobname (string)
  • jobid (string)
 Deletes a job by its name and ID.
  @param jobname - The name of the job.
  @param jobid - The ID of the job.

deleteJobWithInfo

deleteJobWithInfo(jobname: string, jobid: string) : Promise<any>

Parameters

  • jobname (string)
  • jobid (string)
 Deletes a job and returns additional information.
  @param jobname - The name of the job.
  @param jobid - The ID of the job.
  @returns any, A promise that resolves to additional information about the deletion.

downloadSingleSpool

downloadSingleSpool(parms: zoweJobs.IDownloadSpoolContentParms) : Promise<void>

Parameters

  • parms (zoweJobs.IDownloadSpoolContentParms)
 Downloads spool content for a single job.
  @param parms - Parameters for filtering and downloading spool content.
  @returns void, A promise that resolves when the download is complete.

downloadSpoolContent

downloadSpoolContent(parms: zoweJobs.IDownloadAllSpoolContentParms) : Promise<void>

Parameters

  • parms (zoweJobs.IDownloadAllSpoolContentParms)
 Downloads all spool content for jobs matching the provided parameters.
  @param parms - Parameters for filtering and downloading spool content.
  @returns void, A promise that resolves when the download is complete.

getJclForJob

getJclForJob(job: zoweJobs.IJob) : Promise<string>

Parameters

  • job (zoweJobs.IJob)
 Retrieves the JCL for a given job.
  @param job - The job object containing job details.
  @returns string, A promise that resolves to the JCL as a string.

getJob

getJob(jobid: string) : Promise<zoweJobs.IJob>

Parameters

  • jobid (string)
 Retrieves a single job by its ID.
  @param jobid - The ID of the job to retrieve.
  @returns zoweJobs.IJob, A promise that resolves to a zoweJobs.IJob object.

getJobsByParameters

getJobsByParameters(options?: IGetJobsParms) : Promise<zoweJobs.IJob[]>

Parameters

  • options (IGetJobsParms) — optional
 Retrieves a list of jobs based on the provided parameters.
  @param options - Optional parameters for filtering jobs.
  @returns zoweJobs.IJob[], A promise that resolves to an array of zoweJobs.IJob objects.

getSpoolContentById

getSpoolContentById(jobname: string, jobid: string, spoolId: number) : Promise<string>

Parameters

  • jobname (string)
  • jobid (string)
  • spoolId (number)
 Retrieves spool content for a specific spool ID of a job.
  @param jobname - The name of the job.
  @param jobid - The ID of the job.
  @param spoolId - The ID of the spool file.
  @returns string, A promise that resolves to the spool content as a string.

getSpoolFiles

getSpoolFiles(jobname: string, jobid: string) : Promise<zoweJobs.IJobFile[]>

Parameters

  • jobname (string)
  • jobid (string)
 Retrieves spool files for a given job.
  @param jobname - The name of the job.
  @param jobid - The ID of the job.
  @returns zoweJobs.IJobFile[], A promise that resolves to an array of zoweJobs.IJobFile objects.

registerApi

static registerApi(apiRegister: IRegisterClient) : void

Parameters

  • apiRegister (IRegisterClient)
 Static function that is used to register the RSE API with a ZoweExplorerApi.IApiRegisterClient instance.
  @param apiRegister - An instance of ZoweExplorerApi.IApiRegisterClient.

submitJcl

submitJcl(jcl: string, internalReaderRecfm?: string, internalReaderLrecl?: string) : Promise<zoweJobs.IJob>

Parameters

  • jcl (string)
  • internalReaderRecfm (string) — optional
  • internalReaderLrecl (string) — optional
 Submits a JCL string for execution.
  @param jcl - The JCL string to submit.
  @param internalReaderRecfm - Optional internal reader record format.
  @param internalReaderLrecl - Optional internal reader line length.
  @returns zoweJobs.IJob, A promise that resolves to a zoweJobs.IJob object.

submitJob

submitJob(jobDataSet: string) : Promise<zoweJobs.IJob>

Parameters

  • jobDataSet (string)
 Submits a job using a job dataset.
  @param jobDataSet - The job dataset containing job details.
  @returns zoweJobs.IJob, A promise that resolves to a zoweJobs.IJob object.

supportSpoolPagination

supportSpoolPagination() : boolean

RseRestMvsApi

allMembers

allMembers(dataSetName: string, options?: zoweFiles.IListOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • dataSetName (string)
  • options (zoweFiles.IListOptions) — optional
 Asynchronously retrieves a list of all members in the specified dataset.
  @param dataSetName - The name of the dataset.
  @param options - Optional parameters for the list operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

allocateLikeDataSet

allocateLikeDataSet(dataSetName: string, likeDataSetName: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • dataSetName (string)
  • likeDataSetName (string)
 Asynchronously allocates a new dataset similar to an existing one.
  @param dataSetName - The name of the dataset to allocate.
  @param likeDataSetName - The name of the existing dataset to use as a template.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

clearMappingsFile

static clearMappingsFile() : void
 Static function that can be used to reset the cached mappingsFilePath.

copyDataSet

copyDataSet(fromDataSetName: string, toDataSetName: string, enq?: string, replace?: boolean) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • fromDataSetName (string)
  • toDataSetName (string)
  • enq (string) — optional
  • replace (boolean) — optional
 Asynchronously copies a dataset to another dataset.
  @param fromDataSetName - The name of the source dataset.
  @param toDataSetName - The name of the target dataset.
  @param enq - An optional enqueue value.
  @param replace - An optional flag to indicate if the target dataset should be replaced.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

copyDataSetCrossLpar

copyDataSetCrossLpar(toDataSetName: string, toMemberName: string, options: zoweFiles.ICrossLparCopyDatasetOptions, sourceprofile: imperative.IProfileLoaded) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • toDataSetName (string)
  • toMemberName (string)
  • options (zoweFiles.ICrossLparCopyDatasetOptions)
  • sourceprofile (imperative.IProfileLoaded)
 Copies a seq or pds dataset from a source LPAR to the target LPAR.
  @param toDataSetName - The target dataset name on the destination LPAR.
  @param toMemberName - The target member name within the destination dataset.
  @param options - Options controlling the cross-LPAR dataset copy operation.
  @param sourceprofile - The loaded profile representing the source LPAR.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

copyDataSetMember

copyDataSetMember({ dsn: fromDataSetName, member: fromMemberName }: zoweFiles.IDataSet, { dsn: toDataSetName, member: toMemberName }: zoweFiles.IDataSet, _options?: zoweFiles.ICopyDatasetOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • { dsn: fromDataSetName, member: fromMemberName } (zoweFiles.IDataSet)
  • { dsn: toDataSetName, member: toMemberName } (zoweFiles.IDataSet)
  • _options (zoweFiles.ICopyDatasetOptions) — optional
 Asynchronously copies a member from one dataset to another.
  @param from - The source dataset and member.
  @param to - The target dataset and member.
  @param options - Optional parameters for the copy operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

createDataSet

createDataSet(dataSetType: zoweFiles.CreateDataSetTypeEnum, dataSetName: string, options?: Partial<zoweFiles.ICreateDataSetOptions>) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • dataSetType (zoweFiles.CreateDataSetTypeEnum)
  • dataSetName (string)
  • options (Partial(zoweFiles.ICreateDataSetOptions)) — optional
 Asynchronously creates a new dataset.
  @param dataSetType - The type of dataset to create.
  @param dataSetName - The name of the dataset.
  @param options - Optional parameters for the create operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

createDataSetMember

createDataSetMember(dataSetName: string, options?: zoweFiles.IUploadOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • dataSetName (string)
  • options (zoweFiles.IUploadOptions) — optional
 Asynchronously creates a new member in the specified dataset.
  @param dataSetName - The name of the dataset.
  @param options - Optional parameters for the create operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

dataSet

dataSet(filter: string, options?: zoweFiles.IListOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • filter (string)
  • options (zoweFiles.IListOptions) — optional
 Asynchronously retrieves a list of datasets based on the provided filter.
  @param filter - The filter string to search for datasets.
  @param options - Optional parameters for the list operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

dataSetsMatchingPattern

dataSetsMatchingPattern(filter: string[], options?: zoweFiles.IDsmListOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • filter (string[])
  • options (zoweFiles.IDsmListOptions) — optional
 Asynchronously retrieves a list of datasets that match the provided filter pattern.
  @param filter - An array of filter strings to search for datasets.
  @param options - Optional parameters for the list operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

deleteDataSet

deleteDataSet(dataSetName: string, options?: zoweFiles.IDeleteDatasetOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • dataSetName (string)
  • options (zoweFiles.IDeleteDatasetOptions) — optional
 Asynchronously deletes a dataset.
  @param dataSetName - The name of the dataset.
  @param options - Optional parameters for the delete operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

getContents

getContents(dataSetName: string, options?: IDownloadRseSingleOptions, mappingsFilePath?: string, emptyfiledownload?: boolean) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • dataSetName (string)
  • options (IDownloadRseSingleOptions) — optional
  • mappingsFilePath (string) — optional
  • emptyfiledownload (boolean) — optional
 Asynchronously downloads the contents of a dataset to a specified path.
  @param dataSetName - The name of the dataset.
  @param options - Optional parameters for the download operation.
  @param mappingsFilePath - An optional absolute path for a RSE API mappings file.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

getCount

getCount(dataSetPatterns: string[]) : Promise<IDataSetCount>

Parameters

  • dataSetPatterns (string[])
 Retrieve the count of data sets matching the provided filter.
  @param session - Current session
  @param dataSetPatterns - List of name of datasets.
  @returns IDataSetCount, A promise that resolves to an object containing the count and the lastItem.

getMappingsFile

static getMappingsFile() : string | undefined
 If Zowe Explorer is started with a mappings file via settings then clients can retrieve the mappings file here.
  @returns (string | undefined), Full path to the mappings file used for Zowe Explorer.

hMigrateDataSet

hMigrateDataSet(dataSetName: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • dataSetName (string)
 Asynchronously migrates a dataset to HFS.
  @param dataSetName - The name of the dataset to migrate.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

hRecallDataSet

hRecallDataSet(dataSetName: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • dataSetName (string)
 Asynchronously recalls a migrated dataset.
  @param dataSetName - The name of the dataset to recall.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

putContents

putContents(inputPath: string, dataSetName: string, options?: IUploadRseOptions, mappingsFilePath?: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • inputPath (string)
  • dataSetName (string)
  • options (IUploadRseOptions) — optional
  • mappingsFilePath (string) — optional
 Asynchronously uploads contents to a dataset from a specified file path.
  @param inputPath - The file path of the input file.
  @param dataSetName - The name of the dataset.
  @param options - Optional parameters for the upload operation.
  @param mappingsFilePath - An optional absolute path for a RSE API mappings file.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

registerApi

static registerApi(apiRegister: IRegisterClient) : void

Parameters

  • apiRegister (IRegisterClient)
 Static function that is used to register the RSE API with a ZoweExplorerApi.IApiRegisterClient instance.
  @param apiRegister - An instance of ZoweExplorerApi.IApiRegisterClient.

registerMappingsFile

static registerMappingsFile(mappingsFilePath: string) : void

Parameters

  • mappingsFilePath (string)
 Static function to register a mapping file to be used for read/write operations. Can be called many times when client setting change to be updated.
  @param mappingsFilePath - An absolute path for a RSE API mappings file to be used for read/write operations.

renameDataSet

renameDataSet(currentDataSetName: string, newDataSetName: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • currentDataSetName (string)
  • newDataSetName (string)
 Asynchronously renames a dataset.
  @param currentDataSetName - The current name of the dataset.
  @param newDataSetName - The new name for the dataset.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

renameDataSetMember

renameDataSetMember(currentMemberName: string, newMemberName: string, afterMemberName: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • currentMemberName (string)
  • newMemberName (string)
  • afterMemberName (string)
 Asynchronously renames a dataset member.
  @param currentMemberName - The current name of the member.
  @param newMemberName - The new name for the member.
  @param afterMemberName - The name of the member after which the new member should be inserted.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

searchDataSets

searchDataSets(searchOptions: zoweFiles.ISearchOptions) : Promise<zoweFiles.ISearchResponse>

Parameters

  • searchOptions (zoweFiles.ISearchOptions)
 Asynchronously call the performSearch method for a string or regex pattern search within PDS datasets and members.
  @param searchOptions - The search options.
  @returns zoweFiles.ISearchResponse, A promise that resolves to a SearchResponse object.

uploadFromBuffer

uploadFromBuffer(buffer: Buffer, dataSetName: string, options?: zoweFiles.IUploadOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • buffer (Buffer)
  • dataSetName (string)
  • options (zoweFiles.IUploadOptions) — optional
 Asynchronously uploads contents from a buffer to a dataset.
  @param buffer - The buffer containing the contents to upload.
  @param dataSetName - The name of the dataset.
  @param options - Optional parameters for the upload operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to a ZosFilesResponse object.

RseRestSession

checkProtocol

static checkProtocol(protocol: string) : void

Parameters

  • protocol (string)
 Checks if the provided protocol is supported.
  @param protocol - The protocol to check
  @throws
  ImperativeError, If the protocol is not supported

createBasicRestRestSessionFromArguments

static createBasicRestRestSessionFromArguments(args: imperative.ICommandArguments) : imperative.Session

Parameters

  • args (imperative.ICommandArguments)
 Creates a REST Client Session from command line arguments.
  @param args - The arguments specified by the user
  @returns Session, A session for usage in the Zowe REST Client

getSessionType

static getSessionType(profile: imperative.IProfile) : imperative.SessConstants.AUTH_TYPE_CHOICES

Parameters

  • profile (imperative.IProfile)
 Determines the authentication type based on the provided profile.
  @param profile - The rest profile contents
  @returns imperative.SessConstants.AUTH_TYPE_CHOICES, The authentication type

RseRestUssApi

copy

copy(outputPath: string, options?: Omit<object, 'request'>) : Promise<Buffer>

Parameters

  • outputPath (string)
  • options (Omit(object, 'request')) — optional
 Copies a file or directory from USS to the local file system.
  @param outputPath - The output path for the copied file or directory in the local file system.
  @param options - Additional options for the copy operation.
  @returns Buffer, A promise that resolves to the contents of the copied file as a Buffer.

create

create(ussPath: string, type: string, mode?: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • ussPath (string)
  • type (string)
  • mode (string) — optional
 Creates a new file or directory in USS.
  @param ussPath - The path of the new file or directory in USS.
  @param type - The type of the new file or directory ('FILE' or 'DIRECTORY').
  @param mode - The permissions for the new file or directory.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

delete

delete(ussPath: string, recursive?: boolean) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • ussPath (string)
  • recursive (boolean) — optional
 Deletes a file or directory in USS.
  @param ussPath - The path of the file or directory in USS to delete.
  @param recursive - Whether to delete the directory recursively.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

fileList

fileList(ussFilePath: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • ussFilePath (string)
 Lists files in the specified USS file path.
  @param ussFilePath - The path of the USS file to list.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

getContents

getContents(inputFilePath: string, options: IDownloadRseOptions, emptyfiledownload?: boolean) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • inputFilePath (string)
  • options (IDownloadRseOptions)
  • emptyfiledownload (boolean) — optional
 Downloads a file from USS to the local file system.
  @param inputFilePath - The path of the file in USS to download.
  @param options - Additional options for the download operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

getTag

getTag(ussPath: string) : Promise<string>

Parameters

  • ussPath (string)
 Fetches the tag of the USS file passed in.
  @param ussPath - The path of the USS file to fetch the tag.
  @returns string, A promise that resolves to the tag of the USS file.

isFileTagBinOrAscii

isFileTagBinOrAscii(ussFilePath: string) : Promise<boolean>

Parameters

  • ussFilePath (string)
 Checks if the specified USS file is binary or ASCII.
  @param ussFilePath - The path of the USS file to check.
  @returns boolean, A promise that resolves to a boolean indicating whether the file is binary or ASCII.

putContent

putContent(inputFilePath: string, ussFilePath: string, options?: IUploadRseOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • inputFilePath (string)
  • ussFilePath (string)
  • options (IUploadRseOptions) — optional
 Uploads a file from the local file system to USS.
  @param inputFilePath - The path of the file in the local file system to upload.
  @param ussFilePath - The path of the file in USS to upload to.
  @param options - Additional options for the upload operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

registerApi

static registerApi(apiRegister: IRegisterClient) : void

Parameters

  • apiRegister (IRegisterClient)
 Static function that is used to register the RSE API with a ZoweExplorerApi.IApiRegisterClient instance.
  @param apiRegister - An instance of ZoweExplorerApi.IApiRegisterClient.

rename

rename(currentUssPath: string, newUssPath: string) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • currentUssPath (string)
  • newUssPath (string)
 Renames a file or directory in USS.
  @param currentUssPath - The current path of the file or directory in USS.
  @param newUssPath - The new path for the file or directory in USS.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

updateAttributes

updateAttributes(ussPath: string, attributes: Partial<Types.FileAttributes>) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • ussPath (string)
  • attributes (Partial(Types.FileAttributes))
 Updates the attributes of a USS file or directory.
  @param ussPath - The path of the file or directory in USS to update.
  @param attributes - The attributes to update.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

uploadDirectory

uploadDirectory(inputDirectoryPath: string, ussDirectoryPath: string, options?: IUploadRseOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • inputDirectoryPath (string)
  • ussDirectoryPath (string)
  • options (IUploadRseOptions) — optional
 Uploads a directory from the local file system to USS.
  @param inputDirectoryPath - The path of the directory in the local file system to upload.
  @param ussDirectoryPath - The path of the directory in USS to upload to.
  @param options - Additional options for the upload operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

uploadFromBuffer

uploadFromBuffer(buffer: Buffer, filePath: string, options?: zoweFiles.IUploadOptions) : Promise<zoweFiles.IZosFilesResponse>

Parameters

  • buffer (Buffer)
  • filePath (string)
  • options (zoweFiles.IUploadOptions) — optional
 Uploads a buffer to USS.
  @param buffer - The buffer containing the file data.
  @param filePath - The path of the file in USS to upload to.
  @param options - Additional options for the upload operation.
  @returns zoweFiles.IZosFilesResponse, A promise that resolves to an object containing the response status, command response, and API response.

RseTokenAutoRefreshTimer

deleteAutoRefreshTimer

static deleteAutoRefreshTimer(profilename: string) : void

Parameters

  • profilename (string)
 Removes the auto-refresh timer for the specified profile forcefully.
  @param profileName - The name of the profile to remove the timer for.
  @returns void, remove the autoRefreshTimer information from the _autoRefreshTimers storage.

getAutoRefreshTimerFor

static getAutoRefreshTimerFor(profileName: string) : ReturnType<typeof setTimeout>

Parameters

  • profileName (string)
 Retrieves the auto-refresh timer for the specified profile.
  @param profileName - The name of the profile to retrieve the timer for.
  @returns typeof setTimeout, The setTimeout return value for the specified profile, or undefined if no timer is set.

putAutoRefreshTimer

static putAutoRefreshTimer(profileName: string, timerID: ReturnType<typeof setTimeout>) : void

Parameters

  • profileName (string)
  • timerID (ReturnType(typeof setTimeout))
 Sets the auto-refresh timer for the specified profile.
  @param profileName - The name of the profile to set the timer for.
  @param timerID - The setTimeout return value to set as the new timer.

removeAutoRefreshTimerFor

static removeAutoRefreshTimerFor(profileName: string) : boolean

Parameters

  • profileName (string)
 Removes the auto-refresh timer for the specified profile and returns true if a timer was removed.
  @param profileName - The name of the profile to remove the timer for.
  @returns boolean, True if a timer was removed, false otherwise.

mvsMembers

static mvsMembers(session: imperative.Session, filter: string, memberPattern: string, options?: SearchMvsMembersOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • filter (string)
  • memberPattern (string)
  • options (SearchMvsMembersOptions) — optional
 Search MVS member by filter and member pattern or contents
  @param session - The session to use
  @param filter - Dataset filter string. Ex. FILTERNAME.  @param memberPattern - Member name pattern. Ex. MEM or   @param options - options for more detailed search, content or memberPattern must be defined here
  @returns Promise of IRestApiResponse, the result of the search

mvsPds

static mvsPds(session: imperative.Session, filter: string, dsnPattern: string, options?: Partial<SearchMvsPdsOptions>) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • filter (string)
  • dsnPattern (string)
  • options (Partial(SearchMvsPdsOptions)) — optional
 Search a Partitioned Data Set in MVS from a filter and dsn pattern
  @param session - The session to use
  @param filter - Dataset filter string. Ex. FILTERNAME.*.
  @param dsnPattern - Dataset name pattern. Ex. HLQ.PDS or   @param options - optional parameters for more detailed search
  @returns Promise of IRestApiResponse, the results of the search

mvsSeq

static mvsSeq(session: imperative.Session, filter: string, dsnPattern: string, options?: SearchMvsSeqOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • filter (string)
  • dsnPattern (string)
  • options (SearchMvsSeqOptions) — optional
 Search a Sequential Data Set in MVS from a filter and dsn pattern/content
  @param session - The session to use
  @param filter - Dataset filter string. Ex. FILTERNAME.  @param dsnPattern - Dataset name pattern. Ex. HLQ.PDS or   @param options - Parameters for more detailed search, content or dsnPattern must be defined here
  @returns Promise of IRestApiResponse, The results of the search

performSearch

static performSearch(session: imperative.Session, searchOptions: zoweFiles.ISearchOptions) : Promise<zoweFiles.ISearchResponse>

Parameters

  • session (imperative.Session)
  • searchOptions (zoweFiles.ISearchOptions)
 Asynchronously searches for a string or regex pattern within PDS members and SEQ datasets.
  @param session - The session to use for the API call.
  @param searchOptions - The search options.
  @returns zoweFiles.ISearchResponse, A promise that resolves to a SearchResponse object.

uss

static uss(session: imperative.Session, ussPath: string, fileName: string, options?: SearchUssOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • ussPath (string)
  • fileName (string)
  • options (SearchUssOptions) — optional
 Search a unix system services filepath by file name or content
  If options.text is undefined, the response will be reduced to only paths since there will be nothing to match
  @param session - The session to use for the api call
  @param ussPath - The path to search from
  @param fileName - The name of the file to search, default is "*"
  @param options - the options to pass to the call, e.g: file content, case sensitive, etc...
  @returns Promise of IRestApiResponse, The result of the search

StreamContent

streamDownload

static streamDownload(session: imperative.Session, endpoint: string, destination: string, reqHeaders: any[], options?: Partial<IDownloadRseOptions | IDownloadRseSingleOptions>) : Promise<StreamResponse>

Parameters

  • session (imperative.Session)
  • endpoint (string)
  • destination (string)
  • reqHeaders (any[])
  • options (Partial(IDownloadRseOptions | IDownloadRseSingleOptions)) — optional
 Asynchronously downloads a file from a specified endpoint and saves it to a destination.
  @param session - The session object for the HTTP request.
  @param endpoint - The endpoint URL to download the file from.
  @param destination - The local file path to save the downloaded file.
  @param reqHeaders - An array of request headers.
  @param options - Options for the download operation.
  @returns A promise that resolves with a StreamResponse object.

streamUpload

static streamUpload(session: imperative.Session, endpoint: string, filePath: string, reqHeaders: any[], options?: IUploadRseOptions) : Promise<StreamResponse>

Parameters

  • session (imperative.Session)
  • endpoint (string)
  • filePath (string)
  • reqHeaders (any[])
  • options (IUploadRseOptions) — optional
 Asynchronously uploads a file to a specified endpoint using streaming.
  @param session - The session object for the HTTP request.
  @param endpoint - The endpoint URL to upload the file to.
  @param filePath - The local file path of the file to upload.
  @param reqHeaders - An array of request headers.
  @param options - Options for the upload operation.
  @returns A promise that resolves with a StreamResponse object.

SubmitJobs

checkSubmitOptions

static checkSubmitOptions(session: imperative.Session, parms: ISubmitParms, responseJobInfo: IJob) : Promise<IJob | ISpoolFile[]>

Parameters

  • session (imperative.Session)
  • parms (ISubmitParms)
  • responseJobInfo (IJob)
 Common method to handle job submit options
  @param session - RSE connection info
  @param parms - Submit options
  @param responseJobInfo - job document for a previously submitted job
  @returns IJob | ISpoolFile[], Promise that resolves to an IJob or ISpoolFile[]

submitJcl

static submitJcl(session: imperative.Session, jcl: string, internalReaderRecfm?: string, internalReaderLrecl?: string) : Promise<IJob>

Parameters

  • session (imperative.Session)
  • jcl (string)
  • internalReaderRecfm (string) — optional
  • internalReaderLrecl (string) — optional
 Submit a string of JCL to run
  @param session - RSE connection info
  @param jcl - string of JCL that you want to be submit
  @param internalReaderRecfm - record format of the jcl you want to submit. "F" (fixed) or "V" (variable) (optional)
  @param internalReaderLrecl - logical record length of the jcl you want to submit (optional)
  @returns IJob, Promise that resolves to an IJob document with details about the submitted job

submitJclNotify

static submitJclNotify(session: imperative.Session, jcl: string, internalReaderRecfm?: string, internalReaderLrecl?: string) : Promise<IJob>

Parameters

  • session (imperative.Session)
  • jcl (string)
  • internalReaderRecfm (string) — optional
  • internalReaderLrecl (string) — optional
 Submit a JCL string to run
  @param session - RSE connection info
  @param jcl - string of JCL that you want to be submit
  @param internalReaderRecfm - record format of the jcl you want to submit. "F" (fixed) or "V" (variable) (optional)
  @param internalReaderLrecl - logical record length of the jcl you want to submit (optional)
  @returns IJob, Promise that resolves to an IJob document with details about the submitted job

submitJclString

static submitJclString(session: imperative.Session, jcl: string, parms: ISubmitParms) : Promise<IJob | ISpoolFile[]>

Parameters

  • session (imperative.Session)
  • jcl (string)
  • parms (ISubmitParms)
 Submits a JCL string to the mainframe.
  @param session - The mainframe session.
  @param jcl - The JCL string to submit.
  @param parms - The parameters for the submission.
  @returns IJob | ISpoolFile[], A promise that resolves to either an IJob object or an array of ISpoolFile objects.

submitJob

static submitJob(session: imperative.Session, parms: zoweJobs.ISubmitJobParms) : Promise<IJob>

Parameters

  • session (imperative.Session)
  • parms (zoweJobs.ISubmitJobParms)
 Submit a job that resides in a z/OS data set.
  @param session - RSE connection info
  @param parms - job parms object
  @returns IJob, Promise that resolves to an IJob document with details about the submitted job

submitJobNotify

static submitJobNotify(session: imperative.Session, jobDataSet: string) : Promise<IJob>

Parameters

  • session (imperative.Session)
  • jobDataSet (string)
 Submit a job and be notified whenever it reaches the default status on a default polling interval.
  @param session - RSE connection info
  @param jobDataSet - job data set to be translated into parms object with assumed defaults
  @returns IJob, Promise that resolves to an IJob document with details about the submitted job

submitUnixFile

static submitUnixFile(session: imperative.Session, parms: ISubmitParms) : Promise<IJob | ISpoolFile[]>

Parameters

  • session (imperative.Session)
  • parms (ISubmitParms)
 Method to handle submit unix file
  @param session - RSE connection info
  @param parms - Submit options
  @param ussFilePath - Unix file path
  @returns IJob | ISpoolFile[], Promise that resolves to an IJob or ISpoolFile[]

Upload

bufferToDataSet

static bufferToDataSet(session: imperative.Session, filepath: string, dataSetName: string, options?: IUploadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • filepath (string)
  • dataSetName (string)
  • options (IUploadRseOptions) — optional
 Writting data buffer to a data set.
  @param session - z/OS connection info
  @param filepath - file path
  @param dataSetName - Name of the data set to write to
  @param options - Uploading options
  @returns IRestApiResponse, A response indicating the out come

dirToPds

static dirToPds(session: imperative.Session, inputDir: string, dataSetName: string, profile: imperative.IProfile, options?: IUploadRseOptions, mappingsFile?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • inputDir (string)
  • dataSetName (string)
  • profile (imperative.IProfile)
  • options (IUploadRseOptions) — optional
  • mappingsFile (string) — optional
 Upload content from a directory to a PDS
  @param session - z/OS connection info
  @param inputDir - path to a file
  @param dataSetName - Name of the data set to write to
  @param profile - Profile used for connection
  @param options - Uploading options
  @param mappingsFile - path to MVS mappings file (optional)
  @returns IRestApiResponse, A response indicating the out come

dirToUSSDir

static dirToUSSDir(session: imperative.Session, inputDirectory: string, ussname: string, options?: IUploadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • inputDirectory (string)
  • ussname (string)
  • options (IUploadRseOptions) — optional
 Upload local directory to USS directory
  @param session - z/OS connection info
  @param inputDirectory - the path of local directory
  @param ussname - the name of uss folder
  @param options - Uploading options
  @returns IRestApiResponse

dirToUSSDirRecursive

static dirToUSSDirRecursive(session: imperative.Session, inputDirectory: string, ussname: string, options?: IUploadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • inputDirectory (string)
  • ussname (string)
  • options (IUploadRseOptions) — optional
 Recursive function to upload a directory to a USS directory.
  @param session - The session object for making REST API calls.
  @param inputDirectory - The path of the local directory to be uploaded.
  @param ussname - The name of the USS directory where the local directory will be uploaded.
  @param options - Optional parameters for customization.
  @returns IRestApiResponse, A promise that resolves to an object containing the success status, command response message, and API response.

fileToDataset

static fileToDataset(session: imperative.Session, inputFile: string, dataSetName: string, profile: imperative.IProfile, options?: IUploadRseOptions, mappingsFile?: string) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • inputFile (string)
  • dataSetName (string)
  • profile (imperative.IProfile)
  • options (IUploadRseOptions) — optional
  • mappingsFile (string) — optional
 Upload content from file to data set
  @param session - z/OS connection info
  @param inputFile - path to a file
  @param dataSetName - Name of the data set to write to
  @param profile - Profile used for connection
  @param options - Uploading options
  @param mappingsFile - path to MVS mappings file (optional)
  @returns IRestApiResponse, A response indicating the out come

fileToUSSFile

static fileToUSSFile(session: imperative.Session, inputFile: string, ussname: string, options?: IUploadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • inputFile (string)
  • ussname (string)
  • options (IUploadRseOptions) — optional
 Uploads a file to a USS (Unix System Services) file on z/OS.
  @param session - The session object for authentication and communication with the z/OS system.
  @param inputFile - The path to the local file to be uploaded.
  @param ussname - The name of the USS file to upload to.
  @param options - Options for the upload process (Optional)
  @returns IRestApiResponse, A promise that resolves to an object containing the success status, command response message, and result details.
  @throws
  Error, Will throw an error if the input file does not exist, the USS file name is missing, or any other error occurs during the upload process.

isDataSetExist

static isDataSetExist(session: imperative.Session, dataSetName: string, options?: IListOptions) : Promise<boolean>

Parameters

  • session (imperative.Session)
  • dataSetName (string)
  • options (IListOptions) — optional
 Check if USS directory exists
  @param session - z/OS connection info
  @param ussname - the name of uss folder
  @param options - optional
  @returns boolean

isDirectoryExist

static isDirectoryExist(session: imperative.Session, ussname: string) : Promise<boolean>

Parameters

  • session (imperative.Session)
  • ussname (string)
 Check if USS directory exists
  @param session - z/OS connection info
  @param ussname - the name of uss folder
  @returns boolean

isFileExist

static isFileExist(session: imperative.Session, ussname: string) : Promise<boolean>

Parameters

  • session (imperative.Session)
  • ussname (string)
 Check if USS file exists
  @param session - z/OS connection info
  @param ussname - the name of uss folder
  @returns boolean

pathToDataSet

static pathToDataSet(session: imperative.Session, inputPath: string, dataSetName: string, profile: imperative.IProfile, options?: IUploadRseOptions, mappingsFile?: string, isDir?: boolean) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • inputPath (string)
  • dataSetName (string)
  • profile (imperative.IProfile)
  • options (IUploadRseOptions) — optional
  • mappingsFile (string) — optional
  • isDir (boolean) — optional
 Upload content from input path to dataSet or PDS members
  @param session - z/OS connection info
  @param inputPath - User input path to file or directory
  @param dataSetName - Name of the data set to write to
  @param options - Uploading options
  @param task - use this to be updated on the current status of the upload operation
  @returns IZosFilesResponse, A response indicating the out come
  Note: This method does everything needed to do from checking if path is file or directory and if data set is sequential file or PDS to determind what name to be used when upload content to data set. All you have to specify is a directory and a dsname.

tagUssFile

static tagUssFile(session: imperative.Session, ussname: string, encoding: string) : Promise<void>

Parameters

  • session (imperative.Session)
  • ussname (string)
  • encoding (string)
 Asynchronously tags a USS file with the specified encoding.
  @param session - The session object for making API calls.
  @param ussname - The name of the USS file to be tagged.
  @param encoding - The encoding to be applied to the USS file.

uploadFile

static uploadFile(session: imperative.Session, localPath: string, ussPath: string, options?: IUploadRseOptions) : Promise<IRestApiResponse>

Parameters

  • session (imperative.Session)
  • localPath (string)
  • ussPath (string)
  • options (IUploadRseOptions) — optional
 Uploads a file to a USS (Unix System Services) path.
  @param session - The session object for authentication and communication with the target system.
  @param localPath - The local file path to be uploaded.
  @param ussPath - The USS path where the file will be uploaded.
  @param options - The options for the upload operation.
  @returns IRestApiResponse, A promise that resolves to an IRestApiResponse object containing the response from the server.

ZosFilesUtils

formatUnixFilepath

static formatUnixFilepath(usspath: string) : string

Parameters

  • usspath (string)
 Format UNIX filepaths in the way that the APIs expect (no leading /)
  @param usspath - The UNIX path to format.
  @returns string, Formatted UNIX file path.

generateMemberName

static generateMemberName(fileName: string) : string

Parameters

  • fileName (string)
 Generate member name from input string base on IBM specification
  @param fileName - input name used to generate member name with.
  @returns string, generated member name.

getDirsFromDataSet

static getDirsFromDataSet(dataSet: string) : string

Parameters

  • dataSet (string)
 Break up a dataset name into directories.
  @param dataSet - data set to break up into folders
  @returns string, local directory path

getFileListFromPath

static getFileListFromPath(inputPath: string, inFullPathFormat?: boolean, isIgnoreHidden?: boolean) : string[]

Parameters

  • inputPath (string)
  • inFullPathFormat (boolean) — optional
  • isIgnoreHidden (boolean) — optional
 Get list of files from input path.
  @param inputPath - input path
  @param inFullPathFormat - flag to determine if the return file path is in full path format, set true by default.
  @param isIgnoreHidden - flag to determine if hidden files should be ignored, set true by default.
  @returns string[], array of all files found in the path

getFullPath

static getFullPath(inputPath: string) : string

Parameters

  • inputPath (string)
 Get fullpath name from input path.
  @param inputPath - input path
  @returns string, full path version of the input path

isDataSetNameContainMasking

static isDataSetNameContainMasking(dataSetName: string) : boolean

Parameters

  • dataSetName (string)
 Check if the input data set name contain masking characters
  @param dataSetName - input data set name to be checked.
  @returns boolean, status if data set name contain masking characters.

isFileTagBinOrAscii

static isFileTagBinOrAscii(session: imperative.Session, USSFileName: string) : Promise<boolean>

Parameters

  • session (imperative.Session)
  • USSFileName (string)
 Based upon the files chtag value. Identify how the tagging should be interpretted when transferring the contents
  @param session - RSE connection info
  @param USSFileName - contains the file name
  @returns Promise that resolves to true if the file is binary or ASCII text or false if file should likely be converted to text. Default is false which aligns with the default behavior converting

normalizeNewline

static normalizeNewline(buffer: Buffer) : Buffer

Parameters

  • buffer (Buffer)
 Normalize all Windows newline to Unix newline
  @param buffer - data to convert
  @returns Buffer, converted data

sanitizeUssPathForRestCall

static sanitizeUssPathForRestCall(ussPath: string) : string

Parameters

  • ussPath (string)
 Normalize and URL-encode a USS path to be passed to RSE API
  @param ussPath - path to sanitize
  @returns string, sanatized string of USS path

Last Updated:
Contributors: Billie Simmons