String type definition for properties of abstractRestClient that have a getter set. This can be safely used in a getter call as a variable for the abstractRestClient object.
Type for the mode option of the mount file-system API.
z/OSMF options for recall of migrated data sets. See the z/OSMF REST API publication for complete details.
Defaults to be used as options for the different types of data sets that can be created
Specifies all the defaults to create non-vsam data sets
Specifies the defaults used by the Zos Files API to create a blank data set
Specifies the defaults used by the Zos Files API to create a data set used for binaries
Specifies the defaults used by the Zos Files API to create a data set used for C code
Specifies the defaults used by the Zos Files API to create a classic data set
Specifies the defaults used by the Zos Files API to create a partitioned data set
Specifies the defaults used by the Zos Files API to create a sequential data set
Specifies the defaults used by the Zos Files API to create a VSAM cluster
Constants to be used by the API
Maximum value for primary and secondary allocation
Maximum numbers of characters to allow for the continuation character on AMS statements
Maximum length of an AMS statement
Maximum numbers of days for which to retain a dataset.
Minimum numbers of days for which to retain a dataset.
Specifies the z/OS data set and file REST interface
Indicator of an AMS request
Indicator of a data set request
Indicator the query parameters used to qualify the request
Indicator of a members request
Indicator of a ds file name
Indicator of a z/OS mfs
Indicator of a USS File request
Indicator of a USS File request
Indicator of a z/OS file system request
The set of allocation unit choices for VSAM files
The set of dataset organization choices for VSAM files
Messages to be used as command responses for different scenarios
Message indicating that all data sets matching the provided patterns are archived.
Message indicating that the AMS commands was executed successfully
Message indicating the attributes are used during dataset creation
Messaging indicating an attributes file was not found
Message to be used when throwing an imperative error during dataset creation
Message to be used when throwing an imperative error during dataset creation
Message indicating that the data set was created successfully
Message indicating that the data set has been renamed successfully.
Message indicating that file is uploaded to data set successfully
Message indicating that the data set was copied successfully
Message indicating that the data set was deleted successfully
Message indicating that the data set was deleted successfully.
Message indicating that the data set was downloaded successfully
Message indicating that the data set was migrated successfully.
Message indicating that the data set was recalled successfully.
Message indicating that the data sets matching pattern was downloaded successfully
Message indicating an error parsing an attributes file
Message indicating an error reading an attributes file
Message indicating that the file system was mounted successfully.
Message indicating that the file system was unmounted successfully.
Message indicating invalid 'create' command 'alcunit' option
Messaging indicating invalid syntax in .zosattributes file
Message indicating invalid 'create' command 'dsntype' option
Message indicating invalid 'create' command 'dsorg' option
Message indicating an invalid 'create' command option
Message indicating an invalid 'mount' command option
Message indicating invalid 'mount' command 'mode' option
Message indicating that directory blocks cannot be zero if the data set organization is 'PO'
Message indicating that directory blocks must be zero if the data set organization is 'PS'
Message indicating invalid 'create' command 'perms' option
Message indicating invalid 'create' command 'recfm' option
Message indicating that the AMS commands was too long to be passed to z/OS MF
Message indicating the maximum allocation quantity has been exceeded
Message indicating that the following members failed to properly download
Message indicating that the data set "like" name is required
Message indicating that the data set name is required
Message indicating that the data set type is required
Message indicating that the file system name is required
Message indicating the 'create' command options is null or undefined
Message indicating the 'mount' command options is null or undefined
Message indicating that an expected file system option was not supplied.
Message indicating that the input directory is required
Message indicating that the input directory path is required
Message indicating that the input file is required
Message indicating that the mount point is required
Message indicating that patterns were not passed.
Message indicating that the payload is required
Message indicating 'create' command 'primary' option is required
Message indicating 'create' command 'lrecl' option is required
Message indicating that the request type is required
Message indicating that the AMS statements is required
Message indicating that the USS directory name is required
Message indicating that the USS File name is required
Message indicating that the an expected VSAM option was not supplied.
Message indicating that an expected ZFS option was not supplied.
Message indicating that no data sets remain to be downloaded after the excluded ones were filtered out.
Message indicating that no data sets remain to be downloaded after the excluded ones were filtered out.
Message indicating that no data sets remain to be downloaded after the excluded ones were filtered out.
Message indicating that the no members were found
Message indicating that a failure has happened in the NodeJS File System API
Message indicating that only empty partitioned data sets match the provided patterns
Message indicating that input path is not a directory
Message indicating that the data set type is unsupported
Message indicating that attempt to upload a directory to a data set member
Message indicating that attempt to upload a directory with multiple files to a physical sequential data set
Message indicating that the uss file or directory crated successfully.
Message indicating that the uss directory was uploaded successfully
Message indicating that the USS file or directory was deleted successfully
Message indicating that the uss file was downloaded successfully
Message indicating that the uss file was uploaded successfully
Message indicating that the an expected VSAM option was not supplied.
Message indicating that the ZFS was created successfully
Message indicating that the ZFS was deleted successfully
Generated using TypeDoc
z/OS Files Package
Contains APIs to interact with files and data sets on z/OS (using z/OSMF files REST endpoints).
API Examples
Create a dataset
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError, CredentialManagerFactory } from "@zowe/imperative"; import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk"; import { getDefaultProfile } from "@zowe/core-for-zowe-sdk"; import { Create, ICreateDataSetOptions, IZosFilesResponse, CreateDataSetTypeEnum } from "@zowe/zos-files-for-zowe-sdk"; (async () => { //Initialize the Imperative Credential Manager Factory and Logger Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'})); // Uncommment the below line if the Secure Credential Store is in use // await CredentialManagerFactory.initialize({service: "Zowe-Plugin"}); // Get the default z/OSMF profile and create a z/OSMF session with it let defaultZosmfProfile: IProfile; try { defaultZosmfProfile = await getDefaultProfile("zosmf", true); } catch (err) { throw new ImperativeError({msg: "Failed to get a profile."}); } // Create Options const dataset: string = "ZOWEUSER.PUBLIC.NEW.DATASET"; const dataSetType = CreateDataSetTypeEnum.DATA_SET_CLASSIC; const options: ICreateDataSetOptions = { primary: 10, secondary: 1, alcunit: "TRK", lrecl: 80 }; const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile); let response: IZosFilesResponse; response = await Create.dataSet(session, dataSetType, dataset, options); console.log(response); process.exit(0); })().catch((err) => { console.error(err); process.exit(1); });
Download all datasets in a partitioned dataset
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError, CredentialManagerFactory } from "@zowe/imperative"; import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk"; import { getDefaultProfile } from "@zowe/core-for-zowe-sdk"; import { IDownloadOptions, Download, IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk"; (async () => { //Initialize the Imperative Credential Manager Factory and Logger Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'})); // Uncommment the below line if the Secure Credential Store is in use // await CredentialManagerFactory.initialize({service: "Zowe-Plugin"}); // Get the default z/OSMF profile and create a z/OSMF session with it let defaultZosmfProfile: IProfile; try { defaultZosmfProfile = await getDefaultProfile("zosmf", true); } catch (err) { throw new ImperativeError({msg: "Failed to get a profile."}); } // Download Options const dataset: string = "ZOWEUSER.PUBLIC.YOUR.DATASET.HERE"; const options: IDownloadOptions = {failFast: false}; const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile); let response: IZosFilesResponse; response = await Download.allMembers(session, dataset, options); console.log(response); process.exit(0); })().catch((err) => { console.error(err); process.exit(1); });
List datasets on z/OS
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError, CredentialManagerFactory } from "@zowe/imperative"; import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk"; import { getDefaultProfile } from "@zowe/core-for-zowe-sdk"; import { List, IListOptions, IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk"; (async () => { //Initialize the Imperative Credential Manager Factory and Logger Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'})); // Uncommment the below line if the Secure Credential Store is in use // await CredentialManagerFactory.initialize({service: "Zowe-Plugin"}); // Get the default z/OSMF profile and create a z/OSMF session with it let defaultZosmfProfile: IProfile; try { defaultZosmfProfile = await getDefaultProfile("zosmf", true); } catch (err) { throw new ImperativeError({msg: "Failed to get a profile."}); } // List Options const dataset: string = "ZOWEUSER.*"; const options: IListOptions = {}; const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile); let response: IZosFilesResponse; response = await List.dataSet(session, dataset, options); const objArray = response.apiResponse.items; for (const obj of objArray) { if (obj) { console.log(obj.dsname.toString()); } }; process.exit(0); })().catch((err) => { console.error(err); process.exit(1); });
Upload a file to Unix System Services
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError, CredentialManagerFactory } from "@zowe/imperative"; import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk"; import { getDefaultProfile } from "@zowe/core-for-zowe-sdk"; import { Upload, IUploadOptions, IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk"; (async () => { //Initialize the Imperative Credential Manager Factory and Logger Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'})); // Uncommment the below line if the Secure Credential Store is in use // await CredentialManagerFactory.initialize({service: "Zowe-Plugin"}); // Get the default z/OSMF profile and create a z/OSMF session with it let defaultZosmfProfile: IProfile; try { defaultZosmfProfile = await getDefaultProfile("zosmf", true); } catch (err) { throw new ImperativeError({msg: "Failed to get a profile."}); } // Upload Options const localFile: string = "C:/Users/zoweuser/Documents/testFile.txt"; const remoteLocation: string = "/u/zoweuser/file.txt"; const options: IUploadOptions = {binary: true}; const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile); let response: IZosFilesResponse; response = await Upload.fileToUssFile(session, localFile, remoteLocation, options); console.log(response); process.exit(0); })().catch((err) => { console.error(err); process.exit(1); });