From 7e8af88f33ccc3373c112ba86c7544d55bc68feb Mon Sep 17 00:00:00 2001 From: jace-roell Date: Tue, 14 Jan 2025 11:02:34 -0500 Subject: [PATCH 01/51] init Signed-off-by: jace-roell --- .../download-output/Output.definition.ts | 6 +++ .../download-output/Output.handler.ts | 5 ++- packages/zosjobs/src/DownloadJobs.ts | 38 ++++++++++++++----- .../input/IDownloadAllSpoolContentParms.ts | 8 ++++ 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/packages/cli/src/zosjobs/download/download-output/Output.definition.ts b/packages/cli/src/zosjobs/download/download-output/Output.definition.ts index 75e5c89d42..ecee1dd46f 100644 --- a/packages/cli/src/zosjobs/download/download-output/Output.definition.ts +++ b/packages/cli/src/zosjobs/download/download-output/Output.definition.ts @@ -86,6 +86,12 @@ export const OutputDefinition: ICommandDefinition = { type: "boolean", conflictsWith: ["wait-for-active"] }, + { + name: "record-range", aliases: ["rr"], + description: "placeholder.", + type: "string", + optional: true + } ] as ICommandOptionDefinition[]), examples: [ { diff --git a/packages/cli/src/zosjobs/download/download-output/Output.handler.ts b/packages/cli/src/zosjobs/download/download-output/Output.handler.ts index 76725fbba0..f732369f61 100644 --- a/packages/cli/src/zosjobs/download/download-output/Output.handler.ts +++ b/packages/cli/src/zosjobs/download/download-output/Output.handler.ts @@ -37,6 +37,8 @@ export default class OutputHandler extends ZosmfBaseHandler { const encoding: string = this.mArguments.encoding; const waitForActive: boolean = this.mArguments.waitForActive; const waitForOutput: boolean = this.mArguments.waitForOutput; + const recordRange: string = this.mArguments.recordRange; + // Get the job details const job: IJob = await GetJobs.getJob(this.mSession, jobid); const options: IDownloadAllSpoolContentParms = { @@ -49,7 +51,8 @@ export default class OutputHandler extends ZosmfBaseHandler { record, encoding, waitForActive, - waitForOutput + waitForOutput, + recordRange }; // Download 'em all await DownloadJobs.downloadAllSpoolContentCommon(this.mSession, options); diff --git a/packages/zosjobs/src/DownloadJobs.ts b/packages/zosjobs/src/DownloadJobs.ts index 14728422eb..e6b573a57d 100644 --- a/packages/zosjobs/src/DownloadJobs.ts +++ b/packages/zosjobs/src/DownloadJobs.ts @@ -104,20 +104,20 @@ export class DownloadJobs { this.log.trace("Entering downloadSpoolContentCommon with parms %s", JSON.stringify(parms)); ImperativeExpect.keysToBeDefined(parms, ["jobFile"], "You must specify a job file on your 'parms' parameter" + " object to the downloadSpoolContentCommon API."); - - //waiting for job to be active before continuing with job download + + // Waiting for job to be active before continuing with job download if (parms.waitForActive) { await MonitorJobs.waitForActiveStatus(session, parms.jobname, parms.jobid); } - - //waiting for job status to be output before continuing on with job download + + // Waiting for job status to be output before continuing on with job download if (parms.waitForOutput) { await MonitorJobs.waitForJobOutputStatus(session, { jobname: parms.jobname, jobid: parms.jobid } as IJob); } - + const job = parms.jobFile; let debugMessage = `Downloading spool file ${job.ddname} for job ${job.jobname}(${job.jobid})`; let file: string; @@ -127,27 +127,45 @@ export class DownloadJobs { IO.createFileSync(file); debugMessage += ` to ${file}`; } - + this.log.debug(debugMessage); - + let parameters: string = "/" + encodeURIComponent(job.jobname) + "/" + encodeURIComponent(job.jobid) + JobsConstants.RESOURCE_SPOOL_FILES + "/" + encodeURIComponent(job.id) + JobsConstants.RESOURCE_SPOOL_CONTENT; - + if (parms.binary) { parameters += "?mode=binary"; } else if (parms.record) { parameters += "?mode=record"; } - + if (!parms.binary && !parms.record && parms.encoding?.trim()) { parameters += "?fileEncoding=" + parms.encoding; } - + + // Handle record range + if (parms.recordRange) { + const recordRangeMatch = parms.recordRange.match(/^(\d+)-(\d+)$/); // Match multi-digit numbers + if (recordRangeMatch) { + const start = parseInt(recordRangeMatch[1], 10); + const end = parseInt(recordRangeMatch[2], 10); + + if (start >= 0 && end >= start) { // Ensure valid range + parameters += (parameters.includes("?") ? "&" : "?") + `start=${start}&end=${end}`; + } else { + throw new Error(`Invalid record range specified: ${parms.recordRange}. Ensure the format is x-y with x <= y.`); + } + } else { + throw new Error(`Invalid record range format: ${parms.recordRange}. Expected format is x-y.`); + } + } + const writeStream = parms.stream ?? IO.createWriteStream(file); const normalizeResponseNewLines = !(parms.binary || parms.record); await ZosmfRestClient.getStreamed(session, JobsConstants.RESOURCE + parameters, [Headers.TEXT_PLAIN_UTF8], writeStream, normalizeResponseNewLines); } + /** * Get the file where a specified spool file (IJobFile) would be downloaded to diff --git a/packages/zosjobs/src/doc/input/IDownloadAllSpoolContentParms.ts b/packages/zosjobs/src/doc/input/IDownloadAllSpoolContentParms.ts index 13ce91987c..f0968e8af5 100644 --- a/packages/zosjobs/src/doc/input/IDownloadAllSpoolContentParms.ts +++ b/packages/zosjobs/src/doc/input/IDownloadAllSpoolContentParms.ts @@ -78,6 +78,14 @@ export interface IDownloadAllSpoolContentParms { */ encoding?: string; + /** + * Optional record range + * e.g. 0-100 + * @type {string} + * @memberof IDownloadAllSpoolContentParms + */ + recordRange?: string; + /** * Wait for the job to reach output status */ From a04ef3c606d7a7cb7aa67c66dd4bc2443a134840 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 15 Jan 2025 09:50:51 -0500 Subject: [PATCH 02/51] header addition Signed-off-by: jace-roell --- packages/zosjobs/src/DownloadJobs.ts | 33 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/zosjobs/src/DownloadJobs.ts b/packages/zosjobs/src/DownloadJobs.ts index e6b573a57d..eb3752ddca 100644 --- a/packages/zosjobs/src/DownloadJobs.ts +++ b/packages/zosjobs/src/DownloadJobs.ts @@ -104,20 +104,20 @@ export class DownloadJobs { this.log.trace("Entering downloadSpoolContentCommon with parms %s", JSON.stringify(parms)); ImperativeExpect.keysToBeDefined(parms, ["jobFile"], "You must specify a job file on your 'parms' parameter" + " object to the downloadSpoolContentCommon API."); - - // Waiting for job to be active before continuing with job download + + //waiting for job to be active before continuing with job download if (parms.waitForActive) { await MonitorJobs.waitForActiveStatus(session, parms.jobname, parms.jobid); } - - // Waiting for job status to be output before continuing on with job download + + //waiting for job status to be output before continuing on with job download if (parms.waitForOutput) { await MonitorJobs.waitForJobOutputStatus(session, { jobname: parms.jobname, jobid: parms.jobid } as IJob); } - + const job = parms.jobFile; let debugMessage = `Downloading spool file ${job.ddname} for job ${job.jobname}(${job.jobid})`; let file: string; @@ -127,31 +127,33 @@ export class DownloadJobs { IO.createFileSync(file); debugMessage += ` to ${file}`; } - + this.log.debug(debugMessage); - + let parameters: string = "/" + encodeURIComponent(job.jobname) + "/" + encodeURIComponent(job.jobid) + JobsConstants.RESOURCE_SPOOL_FILES + "/" + encodeURIComponent(job.id) + JobsConstants.RESOURCE_SPOOL_CONTENT; - + if (parms.binary) { parameters += "?mode=binary"; } else if (parms.record) { parameters += "?mode=record"; } - + if (!parms.binary && !parms.record && parms.encoding?.trim()) { parameters += "?fileEncoding=" + parms.encoding; } - + + let headers = [Headers.TEXT_PLAIN_UTF8]; + // Handle record range if (parms.recordRange) { const recordRangeMatch = parms.recordRange.match(/^(\d+)-(\d+)$/); // Match multi-digit numbers if (recordRangeMatch) { const start = parseInt(recordRangeMatch[1], 10); const end = parseInt(recordRangeMatch[2], 10); - - if (start >= 0 && end >= start) { // Ensure valid range - parameters += (parameters.includes("?") ? "&" : "?") + `start=${start}&end=${end}`; + + if (start >= 0 && end >= start) { + if(parms.recordRange) headers.push({"X-IBM-Record-Range": `${start}-${end}`}) } else { throw new Error(`Invalid record range specified: ${parms.recordRange}. Ensure the format is x-y with x <= y.`); } @@ -159,13 +161,12 @@ export class DownloadJobs { throw new Error(`Invalid record range format: ${parms.recordRange}. Expected format is x-y.`); } } - + const writeStream = parms.stream ?? IO.createWriteStream(file); const normalizeResponseNewLines = !(parms.binary || parms.record); - await ZosmfRestClient.getStreamed(session, JobsConstants.RESOURCE + parameters, [Headers.TEXT_PLAIN_UTF8], writeStream, + await ZosmfRestClient.getStreamed(session, JobsConstants.RESOURCE + parameters, headers, writeStream, normalizeResponseNewLines); } - /** * Get the file where a specified spool file (IJobFile) would be downloaded to From 35ebc822e45dc57681ceaed6d20b2835fbba6869 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 15 Jan 2025 14:17:27 -0500 Subject: [PATCH 03/51] unit/system testing/flag validation Signed-off-by: jace-roell --- .../__system__/DownloadJobs.system.test.ts | 255 +++++++++++++++++- .../__unit__/DownloadJobs.unit.test.ts | 16 ++ packages/zosjobs/src/DownloadJobs.ts | 8 +- 3 files changed, 275 insertions(+), 4 deletions(-) diff --git a/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts index ba34e0f1ed..42ae70bea6 100644 --- a/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts @@ -57,6 +57,7 @@ describe("Download Jobs - System tests", () => { const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, { jcl: iefbr14JCL }); + testEnvironment.resources.jobs.push(job); jobid = job.jobid; jobname = job.jobname; @@ -289,8 +290,86 @@ describe("Download Jobs - System tests", () => { } } }, LONG_TIMEOUT); - }); + it("should be able to download all DDs from job output with a record range (0-5)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "0-5" + }); + const expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + expect(IO.existsSync(expectedFile)).toEqual(true); + expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); + expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); + expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); + }); + + it("should be able to download all DDs from job output with a record range (2-8)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "2-8" + }); + const expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + expect(IO.existsSync(expectedFile)).toEqual(true); + expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); + expect(IO.readFileSync(expectedFile).toString()).not.toContain("J E S 2 J O B L O G"); + expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); + }); + + it("should be able to download all DDs from job output with a record range (0-100)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "0-100" + }); + const expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + expect(IO.existsSync(expectedFile)).toEqual(true); + expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); + expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); + expect(IO.readFileSync(expectedFile).toString()).toContain("0------ JES2 JOB STATISTICS ------"); + expect(IO.readFileSync(expectedFile).toString()).toContain("MINUTES EXECUTION TIME"); + }); + }); describe("Negative tests", () => { let badJobFile: IJobFile; @@ -345,6 +424,101 @@ describe("Download Jobs - System tests", () => { expect(JSON.parse(err.causeErrors).message).toContain("does not contain spool file"); }); + it("should be able to download all DDs from job output with a record range (0-5)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + let err; + let expectedFile; + try{ + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "0-0" + }); + expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + } + catch(e){ + err = e; + } + + expect(err).toBeDefined(); + expect(err.message).toEqual('Invalid record range specified: 0-0. Ensure the format is x-y with x < y.'); + expect(expectedFile).toBeUndefined(); + }); + + it("should be able to download all DDs from job output with a record range (0-5)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + let err; + let expectedFile; + try{ + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "2-1" + }); + expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + } + catch(e){ + err = e; + } + + expect(err).toBeDefined(); + expect(err.message).toEqual('Invalid record range specified: 2-1. Ensure the format is x-y with x < y.'); + expect(expectedFile).toBeUndefined(); + }); + + it("should be able to download all DDs from job output with a record range (0-5)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + let err; + let expectedFile; + try{ + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "0 50" + }); + expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + } + catch(e){ + err = e; + } + + expect(err).toBeDefined(); + expect(err.message).toEqual('Invalid record range format: 0 50. Expected format is x-y.'); + expect(expectedFile).toBeUndefined(); + }); }); }); @@ -531,5 +705,84 @@ describe("Download Jobs - System tests - Encoded", () => { } } }, LONG_TIMEOUT); + + it("should be able to download all DDs from job output with a record range (0-5)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "0-5" + }); + const expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + expect(IO.existsSync(expectedFile)).toEqual(true); + expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); + expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); + expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); + }); + + it("should be able to download all DDs from job output with a record range (2-8)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "2-8" + }); + const expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + expect(IO.existsSync(expectedFile)).toEqual(true); + expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); + expect(IO.readFileSync(expectedFile).toString()).not.toContain("J E S 2 J O B L O G"); + expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); + }); + + it("should be able to download all DDs from job output with a record range (0-100)", async () => { + for (const file of jobFiles) { + if (file.ddname === "JESMSGLG") { + jesJCLJobFile = file; + } + } + + await DownloadJobs.downloadAllSpoolContentCommon(REAL_SESSION, { + outDir: outputDirectory, + jobid, + jobname, + recordRange: "0-100" + }); + const expectedFile = DownloadJobs.getSpoolDownloadFilePath( + { + jobFile: jesJCLJobFile, + omitJobidDirectory: false, + outDir: outputDirectory + } + ); + expect(IO.existsSync(expectedFile)).toEqual(true); + expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); + expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); + expect(IO.readFileSync(expectedFile).toString()).toContain("0------ JES2 JOB STATISTICS ------"); + expect(IO.readFileSync(expectedFile).toString()).toContain("MINUTES EXECUTION TIME"); + }); }); }); diff --git a/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts b/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts index 2005f52df9..c9bf40dec0 100644 --- a/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts +++ b/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts @@ -473,6 +473,22 @@ describe("DownloadJobs", () => { expect(IO.createDirsSyncFromFilePath).toHaveBeenCalledWith(downloadFilePath); expect(downloadFilePath).not.toContain(spoolParms.jobid); }); + + it("should allow users to call downloadSpoolContentCommon with correct parameters (record range)", async () => { + const jobFile: IJobFile = JSON.parse(JSON.stringify(jobFiles[0])); + const spoolParms: IDownloadSpoolContentParms = { + jobFile: jobFile, + jobid: fakeJobID, + jobname: fakeJobName, + recordRange: "0-100" + }; + const downloadFilePath = DownloadJobs.getSpoolDownloadFilePath(spoolParms); + + await DownloadJobs.downloadSpoolContentCommon(fakeSession, spoolParms); + + expect(IO.createDirsSyncFromFilePath).toHaveBeenCalledWith(downloadFilePath); + expect(downloadFilePath).toContain(DownloadJobs.DEFAULT_JOBS_OUTPUT_DIR); + }); }); }); describe("Error catching - async/ await", () => { diff --git a/packages/zosjobs/src/DownloadJobs.ts b/packages/zosjobs/src/DownloadJobs.ts index eb3752ddca..ae75ed2dc8 100644 --- a/packages/zosjobs/src/DownloadJobs.ts +++ b/packages/zosjobs/src/DownloadJobs.ts @@ -152,10 +152,12 @@ export class DownloadJobs { const start = parseInt(recordRangeMatch[1], 10); const end = parseInt(recordRangeMatch[2], 10); - if (start >= 0 && end >= start) { - if(parms.recordRange) headers.push({"X-IBM-Record-Range": `${start}-${end}`}) + if (start >= 0 && end > start) { + if (parms.recordRange) { + headers.push({ "X-IBM-Record-Range": `${start}-${end}` }); + } } else { - throw new Error(`Invalid record range specified: ${parms.recordRange}. Ensure the format is x-y with x <= y.`); + throw new Error(`Invalid record range specified: ${parms.recordRange}. Ensure the format is x-y with x < y.`); } } else { throw new Error(`Invalid record range format: ${parms.recordRange}. Expected format is x-y.`); From 59a49ce331e4d76ad30dd6f6efb9bd48699a9a10 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 15 Jan 2025 15:00:17 -0500 Subject: [PATCH 04/51] changelog, linting, test names Signed-off-by: jace-roell --- packages/zosfiles/CHANGELOG.md | 2 ++ .../__tests__/__system__/DownloadJobs.system.test.ts | 12 ++++++------ packages/zosjobs/src/DownloadJobs.ts | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index d8d9c25b63..11f87ddbec 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to the Zowe z/OS files SDK package will be documented in thi ## Recent Changes + +- Enhancement: Added `--recordRange` flag to `zowe jobs download output` command to allow users to select a specific range of records to output from a spool file. [#2411](https://github.com/zowe/zowe-cli/pull/2411) - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) ## `8.10.3` diff --git a/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts index 42ae70bea6..53cc7337af 100644 --- a/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts @@ -424,7 +424,7 @@ describe("Download Jobs - System tests", () => { expect(JSON.parse(err.causeErrors).message).toContain("does not contain spool file"); }); - it("should be able to download all DDs from job output with a record range (0-5)", async () => { + it("should be able to download all DDs from job output with a record range (0-0)", async () => { for (const file of jobFiles) { if (file.ddname === "JESMSGLG") { jesJCLJobFile = file; @@ -456,7 +456,7 @@ describe("Download Jobs - System tests", () => { expect(expectedFile).toBeUndefined(); }); - it("should be able to download all DDs from job output with a record range (0-5)", async () => { + it("should be able to download all DDs from job output with a record range (2-1)", async () => { for (const file of jobFiles) { if (file.ddname === "JESMSGLG") { jesJCLJobFile = file; @@ -488,7 +488,7 @@ describe("Download Jobs - System tests", () => { expect(expectedFile).toBeUndefined(); }); - it("should be able to download all DDs from job output with a record range (0-5)", async () => { + it("should be able to download all DDs from job output with a record range (0 50)", async () => { for (const file of jobFiles) { if (file.ddname === "JESMSGLG") { jesJCLJobFile = file; @@ -706,7 +706,7 @@ describe("Download Jobs - System tests - Encoded", () => { } }, LONG_TIMEOUT); - it("should be able to download all DDs from job output with a record range (0-5)", async () => { + it("should be able to download all DDs from job output with a record range (0-5) - encoded", async () => { for (const file of jobFiles) { if (file.ddname === "JESMSGLG") { jesJCLJobFile = file; @@ -732,7 +732,7 @@ describe("Download Jobs - System tests - Encoded", () => { expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); }); - it("should be able to download all DDs from job output with a record range (2-8)", async () => { + it("should be able to download all DDs from job output with a record range (2-8) - encoded", async () => { for (const file of jobFiles) { if (file.ddname === "JESMSGLG") { jesJCLJobFile = file; @@ -758,7 +758,7 @@ describe("Download Jobs - System tests - Encoded", () => { expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); }); - it("should be able to download all DDs from job output with a record range (0-100)", async () => { + it("should be able to download all DDs from job output with a record range (0-100) - encoded", async () => { for (const file of jobFiles) { if (file.ddname === "JESMSGLG") { jesJCLJobFile = file; diff --git a/packages/zosjobs/src/DownloadJobs.ts b/packages/zosjobs/src/DownloadJobs.ts index ae75ed2dc8..780a2e7ca7 100644 --- a/packages/zosjobs/src/DownloadJobs.ts +++ b/packages/zosjobs/src/DownloadJobs.ts @@ -143,7 +143,7 @@ export class DownloadJobs { parameters += "?fileEncoding=" + parms.encoding; } - let headers = [Headers.TEXT_PLAIN_UTF8]; + const headers = [Headers.TEXT_PLAIN_UTF8]; // Handle record range if (parms.recordRange) { From 5d691ad22fe5d9877e01ee6976f3eb2e880e2d3f Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 15 Jan 2025 15:02:15 -0500 Subject: [PATCH 05/51] changelog Signed-off-by: jace-roell --- packages/zosfiles/CHANGELOG.md | 1 - packages/zosjobs/CHANGELOG.md | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 11f87ddbec..8ec444901f 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -5,7 +5,6 @@ All notable changes to the Zowe z/OS files SDK package will be documented in thi ## Recent Changes -- Enhancement: Added `--recordRange` flag to `zowe jobs download output` command to allow users to select a specific range of records to output from a spool file. [#2411](https://github.com/zowe/zowe-cli/pull/2411) - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) ## `8.10.3` diff --git a/packages/zosjobs/CHANGELOG.md b/packages/zosjobs/CHANGELOG.md index 33947ef779..a35978850c 100644 --- a/packages/zosjobs/CHANGELOG.md +++ b/packages/zosjobs/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS jobs SDK package will be documented in this file. +## Recent Changes + +- Enhancement: Added `--recordRange` flag to `zowe jobs download output` command to allow users to select a specific range of records to output from a spool file. [#2411](https://github.com/zowe/zowe-cli/pull/2411) + ## `8.10.2` - BugFix: Check if encoding is set and not empty now works for numeric-only value in encoding (GetJobs.ts). [#2392] (https://github.com/zowe/zowe-cli/pull/2392). From 8e165b8454482584277c40b0760ed78eef06742e Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 15 Jan 2025 15:05:00 -0500 Subject: [PATCH 06/51] changelog Signed-off-by: jace-roell --- packages/cli/CHANGELOG.md | 2 ++ packages/zosjobs/CHANGELOG.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index d98dcf7be5..12da9e7116 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes + +- Enhancement: Added `--recordRange` flag to `zowe jobs download output` command to allow users to select a specific range of records to output from a spool file. [#2411](https://github.com/zowe/zowe-cli/pull/2411) - Enhancement: The `zowe zos-files copy data-set` command no longer requires the target data set to be preallocated. [##2349] (https://github.com/zowe/zowe-cli/issues/2349) ## `8.10.4` diff --git a/packages/zosjobs/CHANGELOG.md b/packages/zosjobs/CHANGELOG.md index a35978850c..0adbdd6185 100644 --- a/packages/zosjobs/CHANGELOG.md +++ b/packages/zosjobs/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to the Zowe z/OS jobs SDK package will be documented in this ## Recent Changes -- Enhancement: Added `--recordRange` flag to `zowe jobs download output` command to allow users to select a specific range of records to output from a spool file. [#2411](https://github.com/zowe/zowe-cli/pull/2411) +- Enhancement: Added `--recordRange` flag logic handling to `DownloadJobs.downloadSpoolContentCommon()` to to allow users to select a specific range of records to output from a spool file. [#2411](https://github.com/zowe/zowe-cli/pull/2411) ## `8.10.2` From d9c51a131c15a3e47bdc687a7a4956381a4dacca Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 15 Jan 2025 15:25:26 -0500 Subject: [PATCH 07/51] snapshot Signed-off-by: jace-roell --- .../__snapshots__/Output.definition.unit.test.ts.snap | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap b/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap index f73cf31e05..9bf049a115 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap @@ -92,6 +92,15 @@ Object { "name": "wait-for-output", "type": "boolean", }, + Object { + "aliases": Array [ + "rr", + ], + "description": "placeholder.", + "name": "record-range", + "optional": true, + "type": "string", + }, ], "positionals": Array [ Object { From d0fe11bf02729d31369db809a2b671bad55de4ca Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 15 Jan 2025 15:47:14 -0500 Subject: [PATCH 08/51] snapshot Signed-off-by: jace-roell --- .../cli.zos-jobs.download.output.integration.test.ts.snap | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap b/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap index 6dd3b29ae4..47b6ba1222 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap @@ -101,6 +101,10 @@ exports[`zos-jobs download output command should display the help 1`] = ` Wait for the job to enter OUTPUT status before completing the command. + --record-range | --rr (string) + + placeholder. + ZOSMF CONNECTION OPTIONS ------------------------ @@ -203,8 +207,8 @@ exports[`zos-jobs download output command should display the help 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: output.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n placeholder.\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n placeholder.\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\" }" `; From a6658d64dc0b224ccefced833aa827e03461f660 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 15 Jan 2025 16:48:41 -0500 Subject: [PATCH 09/51] test fix Signed-off-by: jace-roell --- .../__unit__/DownloadJobs.unit.test.ts | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts b/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts index c9bf40dec0..61b12f88c5 100644 --- a/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts +++ b/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts @@ -582,6 +582,48 @@ describe("DownloadJobs", () => { }); }); /* eslint-enable jest/no-done-callback */ + + it("should throw error regarding record range on spoolParms (0 100)", async () => { + const jobFile: IJobFile = JSON.parse(JSON.stringify(jobFiles[0])); + const spoolParms: IDownloadSpoolContentParms = { + jobFile: jobFile, + jobid: fakeJobID, + jobname: fakeJobName, + recordRange: "0 100" + }; + const downloadFilePath = DownloadJobs.getSpoolDownloadFilePath(spoolParms); + + let err; + try { + await DownloadJobs.downloadSpoolContentCommon(fakeSession, spoolParms); + } catch (e) { + err = e; + } + + expect(err).toBeDefined(); + expect(err.message).toContain(`Invalid record range format: ${spoolParms.recordRange}. Expected format is x-y.`); + }); + + it("should throw error regarding record range on spoolParms (100-0)", async () => { + const jobFile: IJobFile = JSON.parse(JSON.stringify(jobFiles[0])); + const spoolParms: IDownloadSpoolContentParms = { + jobFile: jobFile, + jobid: fakeJobID, + jobname: fakeJobName, + recordRange: "100-0" + }; + const downloadFilePath = DownloadJobs.getSpoolDownloadFilePath(spoolParms); + + let err; + try { + await DownloadJobs.downloadSpoolContentCommon(fakeSession, spoolParms); + } catch (e) { + err = e; + } + + expect(err).toBeDefined(); + expect(err.message).toContain(`Invalid record range specified: ${spoolParms.recordRange}. Ensure the format is x-y with x < y.`); + }); }); describe("Parameter validation tests", () => { From e392704e208a829590ce6d47c9c67ea82d62407d Mon Sep 17 00:00:00 2001 From: jace-roell Date: Thu, 16 Jan 2025 09:11:23 -0500 Subject: [PATCH 10/51] unused var and flag description Signed-off-by: jace-roell --- .../zosjobs/download/download-output/Output.definition.ts | 5 +++-- .../zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/zosjobs/download/download-output/Output.definition.ts b/packages/cli/src/zosjobs/download/download-output/Output.definition.ts index ecee1dd46f..321d294407 100644 --- a/packages/cli/src/zosjobs/download/download-output/Output.definition.ts +++ b/packages/cli/src/zosjobs/download/download-output/Output.definition.ts @@ -87,8 +87,9 @@ export const OutputDefinition: ICommandDefinition = { conflictsWith: ["wait-for-active"] }, { - name: "record-range", aliases: ["rr"], - description: "placeholder.", + name: "record-range", + aliases: ["rr"], + description: "Zero indexed range of records to download from a spool file. (example: 0-100)", type: "string", optional: true } diff --git a/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts b/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts index 61b12f88c5..c0ecdeed28 100644 --- a/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts +++ b/packages/zosjobs/__tests__/__unit__/DownloadJobs.unit.test.ts @@ -591,8 +591,6 @@ describe("DownloadJobs", () => { jobname: fakeJobName, recordRange: "0 100" }; - const downloadFilePath = DownloadJobs.getSpoolDownloadFilePath(spoolParms); - let err; try { await DownloadJobs.downloadSpoolContentCommon(fakeSession, spoolParms); @@ -612,8 +610,6 @@ describe("DownloadJobs", () => { jobname: fakeJobName, recordRange: "100-0" }; - const downloadFilePath = DownloadJobs.getSpoolDownloadFilePath(spoolParms); - let err; try { await DownloadJobs.downloadSpoolContentCommon(fakeSession, spoolParms); From 725620c55c98d624d489d4848945071bc5d30673 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Thu, 16 Jan 2025 09:27:29 -0500 Subject: [PATCH 11/51] snap Signed-off-by: jace-roell --- .../__snapshots__/Output.definition.unit.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap b/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap index 9bf049a115..8e7098cd83 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap @@ -96,7 +96,7 @@ Object { "aliases": Array [ "rr", ], - "description": "placeholder.", + "description": "Zero indexed range of records to download from a spool file. (example: 0-100)", "name": "record-range", "optional": true, "type": "string", From 65f92ebc1a5b414cb34dbd017e9b905c6e73b37f Mon Sep 17 00:00:00 2001 From: jace-roell Date: Thu, 16 Jan 2025 09:53:34 -0500 Subject: [PATCH 12/51] snapshot Signed-off-by: jace-roell --- .../cli.zos-jobs.download.output.integration.test.ts.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap b/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap index 47b6ba1222..6bde84c822 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap @@ -103,7 +103,7 @@ exports[`zos-jobs download output command should display the help 1`] = ` --record-range | --rr (string) - placeholder. + Zero indexed range of records to download from a spool file. (example: 0-100) ZOSMF CONNECTION OPTIONS ------------------------ @@ -207,8 +207,8 @@ exports[`zos-jobs download output command should display the help 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: output.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n placeholder.\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n Zero indexed range of records to download from a spool file. (example: 0-100)\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n placeholder.\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n Zero indexed range of records to download from a spool file. (example: 0-100)\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\" }" `; From a3f4678a42f406a854d71010b56abb67e7a1e833 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 11:56:23 -0500 Subject: [PATCH 13/51] implementation and unit tests Signed-off-by: Pujal --- RELEASE_HISTORY.md | 3 +- .../__packages__/cli-test-utils/package.json | 4 +- lerna.json | 2 +- npm-shrinkwrap.json | 116 +++++++++--------- .../__unit__/copy/ds/Ds.handler.unit.test.ts | 63 +++++++++- packages/cli/package.json | 28 ++--- packages/cli/src/zosfiles/-strings-/en.ts | 6 +- .../cli/src/zosfiles/copy/ds/Ds.definition.ts | 10 ++ .../cli/src/zosfiles/copy/ds/Ds.handler.ts | 16 ++- packages/core/package.json | 6 +- packages/imperative/CHANGELOG.md | 4 + packages/imperative/package.json | 2 +- .../ProfileInfo.TeamConfig.unit.test.ts | 14 ++- .../__tests__/DeferredPromise.unit.test.ts | 47 +++++++ packages/imperative/src/utilities/index.ts | 1 + .../src/utilities/src/DeferredPromise.ts | 53 ++++++++ packages/provisioning/package.json | 8 +- packages/workflows/package.json | 10 +- packages/zosconsole/package.json | 8 +- .../methods/copy/Copy.system.test.ts | 81 ++++++++++++ .../methods/invoke/DefineVSAM.ams.temp | 1 + .../methods/invoke/DeleteVSAM.ams.temp | 1 + .../__unit__/methods/copy/Copy.unit.test.ts | 50 ++++++++ packages/zosfiles/package.json | 10 +- packages/zosfiles/src/methods/copy/Copy.ts | 12 +- .../methods/copy/doc/ICopyDatasetOptions.ts | 15 ++- packages/zosjobs/package.json | 10 +- packages/zoslogs/package.json | 8 +- packages/zosmf/package.json | 8 +- packages/zostso/package.json | 10 +- packages/zosuss/package.json | 6 +- 31 files changed, 480 insertions(+), 133 deletions(-) create mode 100644 packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts create mode 100644 packages/imperative/src/utilities/src/DeferredPromise.ts create mode 100644 packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp create mode 100644 packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp diff --git a/RELEASE_HISTORY.md b/RELEASE_HISTORY.md index 0b2797c4e5..996ec9c844 100644 --- a/RELEASE_HISTORY.md +++ b/RELEASE_HISTORY.md @@ -7,7 +7,8 @@ Zowe follows a regular release schedule with major versions released every two y ### Zowe v3.x LTS Releases | Version | Release Date | Status | Release Notes | |:--------:|:------------:|:----------:|:-------------:| -| v3.0.0-prerelease | 2024-08 | **Under Development** | | +| v3.0.0 | 2024-10 | **Active** | | +| v3.1.0 | 2025-02 | **Under Development** | | ### Major Release Timeline diff --git a/__tests__/__packages__/cli-test-utils/package.json b/__tests__/__packages__/cli-test-utils/package.json index 43e0fc9efb..eab1d2ac72 100644 --- a/__tests__/__packages__/cli-test-utils/package.json +++ b/__tests__/__packages__/cli-test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/cli-test-utils", - "version": "8.10.4", + "version": "8.11.0", "description": "Test utilities package for Zowe CLI plug-ins", "author": "Zowe", "license": "EPL-2.0", @@ -43,7 +43,7 @@ "devDependencies": { "@types/js-yaml": "^4.0.9", "@types/uuid": "^10.0.0", - "@zowe/imperative": "8.10.4" + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" diff --git a/lerna.json b/lerna.json index cee9d13cfc..4e58110f1d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "8.10.4", + "version": "8.11.0", "command": { "publish": { "ignoreChanges": [ diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f9b605540d..13240f3b4e 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -52,7 +52,7 @@ }, "__tests__/__packages__/cli-test-utils": { "name": "@zowe/cli-test-utils", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "find-up": "^5.0.0", @@ -63,7 +63,7 @@ "devDependencies": { "@types/js-yaml": "^4.0.9", "@types/uuid": "^10.0.0", - "@zowe/imperative": "8.10.4" + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" @@ -16271,21 +16271,21 @@ }, "packages/cli": { "name": "@zowe/cli", - "version": "8.10.4", + "version": "8.11.0", "hasInstallScript": true, "license": "EPL-2.0", "dependencies": { - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4", - "@zowe/provisioning-for-zowe-sdk": "8.10.4", - "@zowe/zos-console-for-zowe-sdk": "8.10.4", - "@zowe/zos-files-for-zowe-sdk": "8.10.4", - "@zowe/zos-jobs-for-zowe-sdk": "8.10.4", - "@zowe/zos-logs-for-zowe-sdk": "8.10.4", - "@zowe/zos-tso-for-zowe-sdk": "8.10.4", - "@zowe/zos-uss-for-zowe-sdk": "8.10.4", - "@zowe/zos-workflows-for-zowe-sdk": "8.10.4", - "@zowe/zosmf-for-zowe-sdk": "8.10.4", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0", + "@zowe/provisioning-for-zowe-sdk": "8.11.0", + "@zowe/zos-console-for-zowe-sdk": "8.11.0", + "@zowe/zos-files-for-zowe-sdk": "8.11.0", + "@zowe/zos-jobs-for-zowe-sdk": "8.11.0", + "@zowe/zos-logs-for-zowe-sdk": "8.11.0", + "@zowe/zos-tso-for-zowe-sdk": "8.11.0", + "@zowe/zos-uss-for-zowe-sdk": "8.11.0", + "@zowe/zos-workflows-for-zowe-sdk": "8.11.0", + "@zowe/zosmf-for-zowe-sdk": "8.11.0", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -16298,7 +16298,7 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.10.4", + "@zowe/cli-test-utils": "8.11.0", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" @@ -16354,15 +16354,15 @@ }, "packages/core": { "name": "@zowe/core-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "comment-json": "~4.2.3", "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16373,7 +16373,7 @@ }, "packages/imperative": { "name": "@zowe/imperative", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "@types/yargs": "^17.0.32", @@ -16567,16 +16567,16 @@ }, "packages/provisioning": { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "js-yaml": "^4.1.0" }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16601,15 +16601,15 @@ }, "packages/workflows": { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.10.4" + "@zowe/zos-files-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16621,12 +16621,12 @@ }, "packages/zosconsole": { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16638,17 +16638,17 @@ }, "packages/zosfiles": { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "lodash": "^4.17.21", "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4", - "@zowe/zos-uss-for-zowe-sdk": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0", + "@zowe/zos-uss-for-zowe-sdk": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16680,15 +16680,15 @@ }, "packages/zosjobs": { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.10.4" + "@zowe/zos-files-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16700,12 +16700,12 @@ }, "packages/zoslogs": { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16717,12 +16717,12 @@ }, "packages/zosmf": { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16734,15 +16734,15 @@ }, "packages/zostso": { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.10.4" + "@zowe/zosmf-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" @@ -16754,15 +16754,15 @@ }, "packages/zosuss": { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "license": "EPL-2.0", "dependencies": { "ssh2": "^1.15.0" }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/imperative": "8.11.0" }, "engines": { "node": ">=18.12.0" diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts index 778b440d72..c71536a39c 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts @@ -12,6 +12,9 @@ import { Copy, IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk"; import DsHandler from "../../../../../src/zosfiles/copy/ds/Ds.handler"; import { ZosFilesBaseHandler } from "../../../../../src/zosfiles/ZosFilesBase.handler"; +import { u } from "tar"; +import { resolvePtr } from "dns"; +import en from "../../../../../src/zosfiles/-strings-/en"; describe("DsHandler", () => { const defaultReturn: IZosFilesResponse = { @@ -33,11 +36,24 @@ describe("DsHandler", () => { const fromDataSetName = "ABCD"; const toDataSetName = "EFGH"; + const enq = "SHR"; + const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; + const commandParameters: any = { arguments: { fromDataSetName, - toDataSetName + toDataSetName, + enq, + replace, + safeReplace, + responseTimeout + + }, + response: { + console: { promptFn: jest.fn() } } }; @@ -49,7 +65,14 @@ describe("DsHandler", () => { expect(copyDatasetSpy).toHaveBeenLastCalledWith( dummySession, { dsn: commandParameters.arguments.toDataSetName }, - { "from-dataset": { dsn: commandParameters.arguments.fromDataSetName } } + { + "from-dataset": { dsn: commandParameters.arguments.fromDataSetName }, + "enq": commandParameters.arguments.enq, + "replace": commandParameters.arguments.replace, + "responseTimeout": commandParameters.arguments.responseTimeout, + "safeReplace": commandParameters.arguments.safeReplace, + "promptFn": expect.any(Function) + } ); expect(response).toBe(defaultReturn); }); @@ -63,11 +86,22 @@ describe("DsHandler", () => { const fromMemberName = "mem1"; const toDataSetName = "EFGH"; const toMemberName = "mem2"; + const enq = "SHR"; + const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; const commandParameters: any = { arguments: { fromDataSetName: `${fromDataSetName}(${fromMemberName})`, - toDataSetName: `${toDataSetName}(${toMemberName})` + toDataSetName: `${toDataSetName}(${toMemberName})`, + enq, + replace, + safeReplace, + responseTimeout + }, + response: { + console: { promptFn: jest.fn() } } }; @@ -79,7 +113,14 @@ describe("DsHandler", () => { expect(copyDatasetSpy).toHaveBeenLastCalledWith( dummySession, { dsn: toDataSetName, member: toMemberName }, - { "from-dataset": { dsn: fromDataSetName, member: fromMemberName } } + { + "from-dataset": { dsn: fromDataSetName, member: fromMemberName }, + "enq": commandParameters.arguments.enq, + "replace": commandParameters.arguments.replace, + "responseTimeout": commandParameters.arguments.responseTimeout, + "safeReplace": commandParameters.arguments.safeReplace, + "promptFn": expect.any(Function) + } ); expect(response).toBe(defaultReturn); }); @@ -93,13 +134,20 @@ describe("DsHandler", () => { const toDataSetName = "EFGH"; const enq = "SHR"; const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; const commandParameters: any = { arguments: { fromDataSetName, toDataSetName, enq, - replace + replace, + safeReplace, + responseTimeout + }, + response: { + console: { promptFn: jest.fn() } } }; @@ -114,7 +162,10 @@ describe("DsHandler", () => { { "from-dataset": { dsn: commandParameters.arguments.fromDataSetName }, "enq": commandParameters.arguments.enq, - "replace": commandParameters.arguments.replace + "replace": commandParameters.arguments.replace, + "reseponseTimeout": commandParameters.arguments.responseTimeout, + "safeReplace": commandParameters.arguments.safeReplace, + "promptFn": expect.any(Function) } ); expect(response).toBe(defaultReturn); diff --git a/packages/cli/package.json b/packages/cli/package.json index 987ac43b33..fc82320aa1 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "name": "@zowe/cli", - "version": "8.10.4", - "zoweVersion": "v3.0.0", + "version": "8.11.0", + "zoweVersion": "v3.1.0", "description": "Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.", "author": "Zowe", "license": "EPL-2.0", @@ -58,17 +58,17 @@ "preshrinkwrap": "node ../../scripts/rewriteShrinkwrap.js" }, "dependencies": { - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4", - "@zowe/provisioning-for-zowe-sdk": "8.10.4", - "@zowe/zos-console-for-zowe-sdk": "8.10.4", - "@zowe/zos-files-for-zowe-sdk": "8.10.4", - "@zowe/zos-jobs-for-zowe-sdk": "8.10.4", - "@zowe/zos-logs-for-zowe-sdk": "8.10.4", - "@zowe/zos-tso-for-zowe-sdk": "8.10.4", - "@zowe/zos-uss-for-zowe-sdk": "8.10.4", - "@zowe/zos-workflows-for-zowe-sdk": "8.10.4", - "@zowe/zosmf-for-zowe-sdk": "8.10.4", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0", + "@zowe/provisioning-for-zowe-sdk": "8.11.0", + "@zowe/zos-console-for-zowe-sdk": "8.11.0", + "@zowe/zos-files-for-zowe-sdk": "8.11.0", + "@zowe/zos-jobs-for-zowe-sdk": "8.11.0", + "@zowe/zos-logs-for-zowe-sdk": "8.11.0", + "@zowe/zos-tso-for-zowe-sdk": "8.11.0", + "@zowe/zos-uss-for-zowe-sdk": "8.11.0", + "@zowe/zos-workflows-for-zowe-sdk": "8.11.0", + "@zowe/zosmf-for-zowe-sdk": "8.11.0", "find-process": "1.4.7", "lodash": "4.17.21", "minimatch": "9.0.5", @@ -78,7 +78,7 @@ "@types/diff": "^5.0.9", "@types/lodash": "^4.17.6", "@types/tar": "^6.1.11", - "@zowe/cli-test-utils": "8.10.4", + "@zowe/cli-test-utils": "8.11.0", "comment-json": "^4.2.3", "strip-ansi": "^6.0.1", "which": "^4.0.0" diff --git a/packages/cli/src/zosfiles/-strings-/en.ts b/packages/cli/src/zosfiles/-strings-/en.ts index dad7b32bf6..10aa5b7648 100644 --- a/packages/cli/src/zosfiles/-strings-/en.ts +++ b/packages/cli/src/zosfiles/-strings-/en.ts @@ -195,7 +195,9 @@ export default { TODSNAME: "The name of the data set that you want to copy to" }, OPTIONS: { - REPLACE: "Specify this option as true if you wish to replace like-named members in the target data set" + REPLACE: "Specify this option as true if you wish to replace like-named members in the target data set", + SAFE_REPLACE: "Specify this option as true if you wish to replace like-named members or the content of the target data set." + + "This option will prompt to confirm." }, EXAMPLES: { EX1: "Copy the data set named 'USER.FROM.SET' to the data set named 'USER.TO.SET'", @@ -204,7 +206,7 @@ export default { EX4: "Copy the data set member named 'USER.FROM.SET(MEM1)' to the data set named 'USER.TO.SET'", EX5: "Copy the data set named 'USER.FROM.SET' to the data set named 'USER.TO.SET' and replace like-named members", EX6: "Copy the partitioned data set named 'TEST.PDS1' to the partitioned data set named 'TEST.PDS2'", - EX7: "Copy the partionted data set named 'EXISTING.PDS' to a non-existent target 'NEW.PDS'" + EX7: "Copy the partitioned data set named 'EXISTING.PDS' to a non-existent target 'NEW.PDS'" } }, DATA_SET_CROSS_LPAR: { diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts b/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts index 6324f99352..959be54458 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts @@ -53,6 +53,12 @@ export const DsDefinition: ICommandDefinition = { aliases: ["rep"], description: strings.OPTIONS.REPLACE, type: "boolean" + }, + { + name: "safe-replace", + aliases: ["safe-rep"], + description: strings.OPTIONS.SAFE_REPLACE, + type: "boolean", } ] as ICommandOptionDefinition[]).sort((a, b) => a.name.localeCompare(b.name) @@ -77,6 +83,10 @@ export const DsDefinition: ICommandDefinition = { { description: strings.EXAMPLES.EX5, options: `"USER.FROM.SET" "USER.TO.SET" --replace` + }, + { + description: strings.EXAMPLES.EX6, + options: `"USER.FROM.SET" "USER.TO.SET" --safe-replace` } ] }; diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts index 47a21cfb62..8689ec306d 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts @@ -9,7 +9,7 @@ * */ -import { AbstractSession, IHandlerParameters } from "@zowe/imperative"; +import { AbstractSession, IHandlerParameters, IHandlerResponseConsoleApi } from "@zowe/imperative"; import { Copy, IZosFilesResponse, IDataSet, ICopyDatasetOptions, ZosFilesUtils } from "@zowe/zos-files-for-zowe-sdk"; import { ZosFilesBaseHandler } from "../../ZosFilesBase.handler"; @@ -24,9 +24,21 @@ export default class DsHandler extends ZosFilesBaseHandler { "from-dataset": fromDataSet, enq: commandParameters.arguments.enq, replace: commandParameters.arguments.replace, - responseTimeout: commandParameters.arguments.responseTimeout + responseTimeout: commandParameters.arguments.responseTimeout, + safeReplace: commandParameters.arguments.safeReplace, + promptFn: this.promptForSafeReplace(commandParameters.response.console) }; return Copy.dataSet(session, toDataSet, options); } + + private promptForSafeReplace(console: IHandlerResponseConsoleApi) { + return async (targetDSN: string) => { + const answer: string = await console.prompt( + `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss. + Are you sure you want to continue? [y/N]: ` + ); + return answer != null && (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes"); + }; + } } diff --git a/packages/core/package.json b/packages/core/package.json index 4300ed7478..38adb55a68 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/core-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Core libraries shared by Zowe SDK packages", "author": "Zowe", "license": "EPL-2.0", @@ -49,8 +49,8 @@ "string-width": "^4.2.3" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 7259be27ac..059c83a266 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Imperative package will be documented in this file. +## `8.11.0` + +- Enhancement: Added `DeferredPromise` class to Imperative to provide utilities for data synchronization. [#2405](https://github.com/zowe/zowe-cli/pull/2405) + ## `8.10.4` - BugFix: Fixed a typo in the syntax validation code for positional arguments which caused the validation to never fail. [#2375](https://github.com/zowe/zowe-cli/issues/2375) diff --git a/packages/imperative/package.json b/packages/imperative/package.json index ccbd3c7d7d..7e861fc465 100644 --- a/packages/imperative/package.json +++ b/packages/imperative/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/imperative", - "version": "8.10.4", + "version": "8.11.0", "description": "framework for building configurable CLIs", "author": "Zowe", "license": "EPL-2.0", diff --git a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts index 91bea7b8c6..fb5833a1e0 100644 --- a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts +++ b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts @@ -1367,8 +1367,18 @@ describe("TeamConfig ProfileInfo tests", () => { const targetProfile = profiles.find(p => p.profName === "base1234567"); expect(caughtError).toBeUndefined(); expect(targetProfile).toBeDefined(); - expect(targetProfile?.profLoc?.osLoc?.[0]).toEqual(path.join(testDir,"/ProfInfoApp_proj_nested_global_empty/ProfInfoApp.config.json")); - expect(targetProfile?.profLoc?.osLoc?.[0]).not.toEqual(path.join(testDir,"/ProfInfoApp_proj_nested_global_empty_proj/ProfInfoApp.config.json")); + expect(targetProfile?.profLoc?.osLoc?.[0]).toEqual( + path.join( + testDir, + "/ProfInfoApp_proj_nested_global_empty/ProfInfoApp.config.json" + ) + ); + expect(targetProfile?.profLoc?.osLoc?.[0]).not.toEqual( + path.join( + testDir, + "/ProfInfoApp_proj_nested_global_empty_proj/ProfInfoApp.config.json" + ) + ); }); }); diff --git a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts new file mode 100644 index 0000000000..7ab1cf1bbe --- /dev/null +++ b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts @@ -0,0 +1,47 @@ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ + +import { DeferredPromise, DeferredPromiseStatus } from "../src/DeferredPromise"; + +describe("DeferredPromise constructor", () => { + it("sets resolve and reject functions", () => { + const deferred = new DeferredPromise(); + expect(deferred.promise).toBeInstanceOf(Promise); + expect(deferred.reject).toBeInstanceOf(Function); + expect(deferred.resolve).toBeInstanceOf(Function); + }); +}); + +describe("DeferredPromise.status", () => { + it("returns pending when not yet resolved", () => { + const deferred = new DeferredPromise(); + expect(deferred.status).toBe(DeferredPromiseStatus.Pending); + }); + + it("returns resolved when resolved", () => { + const deferred = new DeferredPromise(); + deferred.resolve(null); + expect(deferred.status).toBe(DeferredPromiseStatus.Resolved); + }); + + it("returns rejected when rejected", async () => { + const deferred = new DeferredPromise(); + let errorCaught = false; + setImmediate(() => deferred.reject()); + try { + await deferred.promise; + } catch (err) { + errorCaught = true; + } + expect(deferred.status).toBe(DeferredPromiseStatus.Rejected); + expect(errorCaught).toBe(true); + }); +}); diff --git a/packages/imperative/src/utilities/index.ts b/packages/imperative/src/utilities/index.ts index b3464e1879..360b5f3d30 100644 --- a/packages/imperative/src/utilities/index.ts +++ b/packages/imperative/src/utilities/index.ts @@ -26,3 +26,4 @@ export * from "./src/doc/ISystemInfo"; export * from "./src/diff/DiffUtils"; export * from "./src/diff/doc/IDiffOptions"; export * from "./src/diff/doc/IDiffNameOptions"; +export * from "./src/DeferredPromise"; diff --git a/packages/imperative/src/utilities/src/DeferredPromise.ts b/packages/imperative/src/utilities/src/DeferredPromise.ts new file mode 100644 index 0000000000..65324d0855 --- /dev/null +++ b/packages/imperative/src/utilities/src/DeferredPromise.ts @@ -0,0 +1,53 @@ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ + +/* Status of the deferred promise */ +export enum DeferredPromiseStatus { + Pending = "pending", + Resolved = "resolved", + Rejected = "rejected", +} + +/** + * @brief Externally control the resolution and rejection of a promise. + * + * @details + * Creates a promise with accessible `resolve` and `reject` methods, enabling external entities to + * settle the promise based on custom logic or asynchronous events. This is particularly useful when + * the promise's outcome depends on factors outside the immediate context. + */ +export class DeferredPromise { + private mStatus: DeferredPromiseStatus = DeferredPromiseStatus.Pending; + + public promise: Promise; + public resolve: (value: T | PromiseLike) => void; + public reject: (reason?: any) => void; + + public constructor() { + this.promise = new Promise((resolve, reject) => { + this.resolve = (value): void => { + this.mStatus = DeferredPromiseStatus.Resolved; + resolve(value); + }; + this.reject = (err): void => { + this.mStatus = DeferredPromiseStatus.Rejected; + reject(err); + }; + }); + } + + /** + * @returns {PromiseStatus} The status of the deferred promise + */ + public get status(): DeferredPromiseStatus { + return this.mStatus; + } +} diff --git a/packages/provisioning/package.json b/packages/provisioning/package.json index 6230caf808..e4177a54f6 100644 --- a/packages/provisioning/package.json +++ b/packages/provisioning/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/provisioning-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS provisioning APIs", "author": "Zowe", "license": "EPL-2.0", @@ -49,9 +49,9 @@ }, "devDependencies": { "@types/js-yaml": "^4.0.9", - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/workflows/package.json b/packages/workflows/package.json index 435a68db9b..abb563c26f 100644 --- a/packages/workflows/package.json +++ b/packages/workflows/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-workflows-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS workflows APIs", "author": "Zowe", "license": "EPL-2.0", @@ -45,12 +45,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.10.4" + "@zowe/zos-files-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosconsole/package.json b/packages/zosconsole/package.json index d7ed7246af..c980c3cd63 100644 --- a/packages/zosconsole/package.json +++ b/packages/zosconsole/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-console-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS console", "author": "Zowe", "license": "EPL-2.0", @@ -45,9 +45,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index bccc37a439..db23bfe4fa 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -466,6 +466,87 @@ describe("Copy", () => { expect(contents1.toString()).toEqual(contents2.toString()); }); }); + + describe("Safe replace option", () => { + const promptFn = jest.fn(); + beforeEach(async () => { + try { + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_SEQUENTIAL, fromDataSetName); + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_SEQUENTIAL, toDataSetName); + await Upload.fileToDataset(REAL_SESSION, fileLocation, fromDataSetName); + await Copy.dataSet( + REAL_SESSION, + { dsn: toDataSetName }, + { "from-dataset": { dsn: fromDataSetName } } + ); + } catch (err) { + Imperative.console.info(`Error: ${inspect(err)}`); + } + }); + + it("Should succeed with safe replace option", async () => { + let error; + let response; + let contents1; + let contents2; + promptFn.mockResolvedValue(true); + + try { + response = await Copy.dataSet( + REAL_SESSION, + { dsn: toDataSetName}, + { + "from-dataset": { dsn: fromDataSetName }, + "safeReplace": true, + promptFn + } + ); + contents1 = await Get.dataSet(REAL_SESSION, `${fromDataSetName}`); + contents2 = await Get.dataSet(REAL_SESSION, `${toDataSetName}`); + Imperative.console.info(`Response: ${inspect(response)}`); + } catch (err) { + error = err; + Imperative.console.info(`Error: ${inspect(err)}`); + } + + expect(error).toBeFalsy(); + expect(promptFn).toHaveBeenCalledWith(toDataSetName); + expect(response).toBeTruthy(); + expect(response.success).toBe(true); + expect(response.commandResponse).toContain(ZosFilesMessages.datasetCopiedSuccessfully.message); + + expect(contents1).toBeTruthy(); + expect(contents2).toBeTruthy(); + expect(contents1.toString()).toEqual(contents2.toString()); + }); + + it("Should result in error when safe replace option is selected but the user declines the prompt", async () => { + let error; + let response; + promptFn.mockResolvedValue(false); + + try { + response = await Copy.dataSet( + REAL_SESSION, + { dsn: toDataSetName, member: file2 }, + { + "from-dataset": { dsn: fromDataSetName}, + "safeReplace": true, + promptFn + } + ); + Imperative.console.info(`Response: ${inspect(response)}`); + } catch (err) { + error = err; + Imperative.console.info(`Error: ${inspect(err)}`); + } + + expect(error).toBeTruthy(); + expect(error.message).toContain(ZosFilesMessages.datasetCopiedAborted.message); + expect(response).toBeFalsy(); + }); + + }); describe("responseTimeout option", () => { beforeEach(async () => { try { diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp b/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp new file mode 100644 index 0000000000..9bd65e97a9 --- /dev/null +++ b/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp @@ -0,0 +1 @@ +DEFINE CLUSTER (NAME (PG899423.ZOSFILE.ENCO#ED.VSAM.A196525) CYLINDERS (5 2 ) VOLUMES(TSOE20)) \ No newline at end of file diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp b/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp new file mode 100644 index 0000000000..d7b3d3464e --- /dev/null +++ b/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp @@ -0,0 +1 @@ +DELETE PG899423.ZOSFILE.ENCO#ED.VSAM.A196525 CLUSTER \ No newline at end of file diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 2cfbf762ff..7934c7df05 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -36,6 +36,7 @@ describe("Copy", () => { const toMemberName = "mem2"; const isPDSSpy = jest.spyOn(Copy as any, "isPDS"); let dataSetExistsSpy: jest.SpyInstance; + const promptFn = jest.fn(); beforeEach(() => { copyPDSSpy.mockClear(); @@ -459,6 +460,55 @@ describe("Copy", () => { expect(lastArgumentOfCall).toHaveProperty("replace", false); }); }); + describe("Safe replace option", () => { + it("should not throw error if safeReplace has value of true", async () => { + promptFn.mockResolvedValue(true); + + const response = await Copy.dataSet( + dummySession, + { dsn: toDataSetName }, + { "from-dataset": { dsn: fromDataSetName }, + safeReplace: true, + promptFn } + ); + expect(copyExpectStringSpy).toHaveBeenCalledTimes(1); + const argumentsOfCall = copyExpectStringSpy.mock.calls[0]; + const lastArgumentOfCall = argumentsOfCall[argumentsOfCall.length - 1]; + expect(lastArgumentOfCall).toHaveProperty("safeReplace", true); + expect(response).toEqual({success: true, commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message}); + expect(promptFn).toHaveBeenCalledWith(toDataSetName); + }); + + it("should throw error if user declines to replace the dataset", async () => { + promptFn.mockResolvedValue(false); + + await expect(Copy.dataSet( + dummySession, + { dsn: toDataSetName }, + { "from-dataset": { dsn: fromDataSetName }, + safeReplace: true, + promptFn } + )).rejects.toThrow(new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAborted.message })); + + expect(promptFn).toHaveBeenCalledWith(toDataSetName); + + }); + + it("should not throw error if safeReplace has value of false", async () => { + await expect(Copy.dataSet( + dummySession, + { dsn: toDataSetName }, + { "from-dataset": { dsn: fromDataSetName }, + safeReplace: false, + } + )).resolves.not.toThrow(); + expect(copyExpectStringSpy).toHaveBeenCalledTimes(1); + const argumentsOfCall = copyExpectStringSpy.mock.calls[0]; + const lastArgumentOfCall = argumentsOfCall[argumentsOfCall.length - 1]; + expect(lastArgumentOfCall).toHaveProperty("safeReplace", false); + }); + + }); describe("Partitioned > Partitioned", () => { let createSpy: jest.SpyInstance; let dataSetExistsSpy: jest.SpyInstance; diff --git a/packages/zosfiles/package.json b/packages/zosfiles/package.json index d3a62bf394..ff7f87b7c1 100644 --- a/packages/zosfiles/package.json +++ b/packages/zosfiles/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-files-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with files and data sets on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -50,10 +50,10 @@ "minimatch": "^9.0.5" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4", - "@zowe/zos-uss-for-zowe-sdk": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0", + "@zowe/zos-uss-for-zowe-sdk": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index cce57fd5fd..5a29673a9a 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -57,8 +57,9 @@ export class Copy { ): Promise { ImperativeExpect.toBeDefinedAndNonBlank(options["from-dataset"].dsn, "fromDataSetName"); ImperativeExpect.toBeDefinedAndNonBlank(toDataSetName, "toDataSetName"); + const safeReplace: boolean = options.safeReplace; - if(options["from-dataset"].dsn === toDataSetName) { + if(options["from-dataset"].dsn === toDataSetName && toMemberName === options["from-dataset"].member) { return { success: false, commandResponse: ZosFilesMessages.identicalDataSets.message @@ -71,6 +72,15 @@ export class Copy { if (newDataSet) { await Create.dataSetLike(session, toDataSetName, options["from-dataset"].dsn); } + else if(safeReplace) { + if (options.promptFn != null) { + const userResponse = await options.promptFn(toDataSetName); + + if(!userResponse) { + throw new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAborted.message }); + } + } + } if(!toMemberName && !options["from-dataset"].member) { const sourceIsPds = await this.isPDS(session, options["from-dataset"].dsn); const targetIsPds = await this.isPDS(session, toDataSetName); diff --git a/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts b/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts index b0e2285db6..de9e68662d 100644 --- a/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts +++ b/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts @@ -30,8 +30,21 @@ export interface ICopyDatasetOptions extends IZosFilesOptions { enq?: string; /** - * Replace option + * Replace option (DEPRECATED) * @type {boolean} */ replace?: boolean; + + /** + * Safe replace option + * @type {boolean}; + */ + safeReplace?: boolean; + + /** + * Prompt callback that will be invoked before overwiting a data set. + * @param targetDSN Name of data set that already exists + * @returns True if target data set should be overwritten + */ + promptFn?: (targetDSN: string) => Promise; } diff --git a/packages/zosjobs/package.json b/packages/zosjobs/package.json index 21fde31efa..687d05101d 100644 --- a/packages/zosjobs/package.json +++ b/packages/zosjobs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-jobs-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with jobs on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -46,12 +46,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zos-files-for-zowe-sdk": "8.10.4" + "@zowe/zos-files-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zoslogs/package.json b/packages/zoslogs/package.json index 7ab2cf3128..1700fa0de5 100644 --- a/packages/zoslogs/package.json +++ b/packages/zoslogs/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-logs-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS logs", "author": "Zowe", "license": "EPL-2.0", @@ -45,9 +45,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosmf/package.json b/packages/zosmf/package.json index 32f07b4d54..7342062b5d 100644 --- a/packages/zosmf/package.json +++ b/packages/zosmf/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zosmf-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with the z/OS Management Facility", "author": "Zowe", "license": "EPL-2.0", @@ -44,9 +44,9 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zostso/package.json b/packages/zostso/package.json index 4cac1b54bb..f2c3488dbc 100644 --- a/packages/zostso/package.json +++ b/packages/zostso/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-tso-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with TSO on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -45,12 +45,12 @@ "prepack": "node ../../scripts/prepareLicenses.js" }, "dependencies": { - "@zowe/zosmf-for-zowe-sdk": "8.10.4" + "@zowe/zosmf-for-zowe-sdk": "8.11.0" }, "devDependencies": { - "@zowe/cli-test-utils": "8.10.4", - "@zowe/core-for-zowe-sdk": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/core-for-zowe-sdk": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/core-for-zowe-sdk": "^8.0.0", diff --git a/packages/zosuss/package.json b/packages/zosuss/package.json index dfc0cef6a5..1de62e5c88 100644 --- a/packages/zosuss/package.json +++ b/packages/zosuss/package.json @@ -1,6 +1,6 @@ { "name": "@zowe/zos-uss-for-zowe-sdk", - "version": "8.10.4", + "version": "8.11.0", "description": "Zowe SDK to interact with USS on z/OS", "author": "Zowe", "license": "EPL-2.0", @@ -49,8 +49,8 @@ }, "devDependencies": { "@types/ssh2": "^1.11.19", - "@zowe/cli-test-utils": "8.10.4", - "@zowe/imperative": "8.10.4" + "@zowe/cli-test-utils": "8.11.0", + "@zowe/imperative": "8.11.0" }, "peerDependencies": { "@zowe/imperative": "^8.0.0" From 62eab1d37405db5cd747f5b530dfa08086932a5e Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 12:00:23 -0500 Subject: [PATCH 14/51] update snapshots Signed-off-by: Pujal --- .../ds/__snapshots__/Ds.definition.unit.test.ts.snap | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap index cee4e8287e..a99ecb2810 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap @@ -10,6 +10,14 @@ Array [ "name": "replace", "type": "boolean", }, + Object { + "aliases": Array [ + "safe-rep", + ], + "description": "Specify this option as true if you wish to replace like-named members or the content of the target data set.This option will prompt to confirm.", + "name": "safe-replace", + "type": "boolean", + }, ] `; @@ -35,5 +43,9 @@ Array [ "description": "Copy the data set named 'USER.FROM.SET' to the data set named 'USER.TO.SET' and replace like-named members", "options": "\\"USER.FROM.SET\\" \\"USER.TO.SET\\" --replace", }, + Object { + "description": "Copy the partitioned data set named 'TEST.PDS1' to the partitioned data set named 'TEST.PDS2'", + "options": "\\"USER.FROM.SET\\" \\"USER.TO.SET\\" --safe-replace", + }, ] `; From 484775d744387f6a346c44fe8196273cc6f306bd Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 13:12:46 -0500 Subject: [PATCH 15/51] Updated changelog Signed-off-by: Pujal --- packages/cli/CHANGELOG.md | 3 +++ .../cli.files.copy.ds.integration.test.ts.snap | 14 ++++++++++++-- packages/zosfiles/CHANGELOG.md | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index d98dcf7be5..84d227ac06 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log All notable changes to the Zowe CLI package will be documented in this file. +## Recent Changes +- BugFix: Added a `--safe-replace` option that prompts the user to confirm overwriting the contents of the target data set. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) + ## Recent Changes - Enhancement: The `zowe zos-files copy data-set` command no longer requires the target data set to be preallocated. [##2349] (https://github.com/zowe/zowe-cli/issues/2349) diff --git a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap index 63dd437f15..7c77bb278b 100644 --- a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap @@ -37,6 +37,11 @@ exports[`Copy Data Set should display the help 1`] = ` Specify this option as true if you wish to replace like-named members in the target data set + --safe-replace | --safe-rep (boolean) + + Specify this option as true if you wish to replace like-named members or the + content of the target data set.This option will prompt to confirm. + --response-timeout | --rto (number) The maximum amount of time in seconds the z/OSMF Files TSO servlet should run @@ -161,6 +166,11 @@ exports[`Copy Data Set should display the help 1`] = ` $ zowe zos-files copy data-set \\"USER.FROM.SET\\" \\"USER.TO.SET\\" --replace + - Copy the partitioned data set named 'TEST.PDS1' to the + partitioned data set named 'TEST.PDS2': + + $ zowe zos-files copy data-set \\"USER.FROM.SET\\" \\"USER.TO.SET\\" --safe-replace + " `; @@ -170,8 +180,8 @@ exports[`Copy Data Set should display the help in json format 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: data-set.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set.This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set.This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" }" `; diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index d8d9c25b63..f383845b5e 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. +## Recent Changes +- Bug Fix: The `Copy.data.set` function now prompts the user to confirm overwriting the contents of the target data set with the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## Recent Changes - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) From af98302d9a35f86f6d1a8357e8b54d23c45c24c3 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 13:16:10 -0500 Subject: [PATCH 16/51] unused import fix Signed-off-by: Pujal --- .../zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts index c71536a39c..7f394f43fe 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts @@ -12,9 +12,6 @@ import { Copy, IZosFilesResponse } from "@zowe/zos-files-for-zowe-sdk"; import DsHandler from "../../../../../src/zosfiles/copy/ds/Ds.handler"; import { ZosFilesBaseHandler } from "../../../../../src/zosfiles/ZosFilesBase.handler"; -import { u } from "tar"; -import { resolvePtr } from "dns"; -import en from "../../../../../src/zosfiles/-strings-/en"; describe("DsHandler", () => { const defaultReturn: IZosFilesResponse = { From 981bdc1b7c8ecd6e0dc741a530761525b184feb8 Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:18:10 -0500 Subject: [PATCH 17/51] Delete packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- .../__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp b/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp deleted file mode 100644 index d7b3d3464e..0000000000 --- a/packages/zosfiles/__tests__/__system__/methods/invoke/DeleteVSAM.ams.temp +++ /dev/null @@ -1 +0,0 @@ -DELETE PG899423.ZOSFILE.ENCO#ED.VSAM.A196525 CLUSTER \ No newline at end of file From 85db2c49f7bed9b9cf618ce16a6cbcbf043dcdd3 Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:18:22 -0500 Subject: [PATCH 18/51] Delete packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- .../__tests__/__system__/methods/invoke/DefineVSAM.ams.temp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp b/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp deleted file mode 100644 index 9bd65e97a9..0000000000 --- a/packages/zosfiles/__tests__/__system__/methods/invoke/DefineVSAM.ams.temp +++ /dev/null @@ -1 +0,0 @@ -DEFINE CLUSTER (NAME (PG899423.ZOSFILE.ENCO#ED.VSAM.A196525) CYLINDERS (5 2 ) VOLUMES(TSOE20)) \ No newline at end of file From d45ef6ca72bca230b7525916d6ae100d7200eb0e Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 13:58:03 -0500 Subject: [PATCH 19/51] fixed en.ts error Signed-off-by: Pujal --- packages/cli/src/zosfiles/-strings-/en.ts | 2 +- .../__tests__/DeferredPromise.unit.test.ts | 20 +++++++++---------- .../src/utilities/src/DeferredPromise.ts | 20 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/cli/src/zosfiles/-strings-/en.ts b/packages/cli/src/zosfiles/-strings-/en.ts index 10aa5b7648..8649f8866b 100644 --- a/packages/cli/src/zosfiles/-strings-/en.ts +++ b/packages/cli/src/zosfiles/-strings-/en.ts @@ -196,7 +196,7 @@ export default { }, OPTIONS: { REPLACE: "Specify this option as true if you wish to replace like-named members in the target data set", - SAFE_REPLACE: "Specify this option as true if you wish to replace like-named members or the content of the target data set." + + SAFE_REPLACE: "Specify this option as true if you wish to replace like-named members or the content of the target data set. " + "This option will prompt to confirm." }, EXAMPLES: { diff --git a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts index 146067c919..7ab1cf1bbe 100644 --- a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts @@ -1,13 +1,13 @@ -/** - * This program and the accompanying materials are made available under the terms of the - * Eclipse Public License v2.0 which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-v20.html - * - * SPDX-License-Identifier: EPL-2.0 - * - * Copyright Contributors to the Zowe Project. - * - */ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ import { DeferredPromise, DeferredPromiseStatus } from "../src/DeferredPromise"; diff --git a/packages/imperative/src/utilities/src/DeferredPromise.ts b/packages/imperative/src/utilities/src/DeferredPromise.ts index 20b8fcfd22..65324d0855 100644 --- a/packages/imperative/src/utilities/src/DeferredPromise.ts +++ b/packages/imperative/src/utilities/src/DeferredPromise.ts @@ -1,13 +1,13 @@ -/** - * This program and the accompanying materials are made available under the terms of the - * Eclipse Public License v2.0 which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-v20.html - * - * SPDX-License-Identifier: EPL-2.0 - * - * Copyright Contributors to the Zowe Project. - * - */ +/* +* This program and the accompanying materials are made available under the terms of the +* Eclipse Public License v2.0 which accompanies this distribution, and is available at +* https://www.eclipse.org/legal/epl-v20.html +* +* SPDX-License-Identifier: EPL-2.0 +* +* Copyright Contributors to the Zowe Project. +* +*/ /* Status of the deferred promise */ export enum DeferredPromiseStatus { From 37c02a58ef838f9f3ad396e4c4f4de4bbf9147e4 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 16 Jan 2025 14:15:50 -0500 Subject: [PATCH 20/51] updated snapshots Signed-off-by: Pujal --- .../cli.files.copy.ds.integration.test.ts.snap | 6 +++--- .../copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap index 7c77bb278b..c439ffd6e3 100644 --- a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap @@ -40,7 +40,7 @@ exports[`Copy Data Set should display the help 1`] = ` --safe-replace | --safe-rep (boolean) Specify this option as true if you wish to replace like-named members or the - content of the target data set.This option will prompt to confirm. + content of the target data set. This option will prompt to confirm. --response-timeout | --rto (number) @@ -180,8 +180,8 @@ exports[`Copy Data Set should display the help in json format 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: data-set.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set.This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set.This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" }" `; diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap index a99ecb2810..0bc8ffcfc4 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap @@ -14,7 +14,7 @@ Array [ "aliases": Array [ "safe-rep", ], - "description": "Specify this option as true if you wish to replace like-named members or the content of the target data set.This option will prompt to confirm.", + "description": "Specify this option as true if you wish to replace like-named members or the content of the target data set. This option will prompt to confirm.", "name": "safe-replace", "type": "boolean", }, From f18a8d65848ae62b2c7486bcdc8345258a045481 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 10:04:17 -0500 Subject: [PATCH 21/51] updated handler Signed-off-by: Pujal --- packages/cli/src/zosfiles/copy/ds/Ds.handler.ts | 3 +-- .../src/utilities/__tests__/DeferredPromise.unit.test.ts | 2 +- packages/imperative/src/utilities/src/DeferredPromise.ts | 2 +- packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts index 8689ec306d..4d81a1c3a9 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts @@ -35,8 +35,7 @@ export default class DsHandler extends ZosFilesBaseHandler { private promptForSafeReplace(console: IHandlerResponseConsoleApi) { return async (targetDSN: string) => { const answer: string = await console.prompt( - `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss. - Are you sure you want to continue? [y/N]: ` + `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss. Are you sure you want to continue? [y/N]: ` ); return answer != null && (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes"); }; diff --git a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts index 7ab1cf1bbe..7e0806ce4a 100644 --- a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts @@ -1,4 +1,4 @@ -/* +/** * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html diff --git a/packages/imperative/src/utilities/src/DeferredPromise.ts b/packages/imperative/src/utilities/src/DeferredPromise.ts index 65324d0855..fdcec4b54a 100644 --- a/packages/imperative/src/utilities/src/DeferredPromise.ts +++ b/packages/imperative/src/utilities/src/DeferredPromise.ts @@ -1,4 +1,4 @@ -/* +/** * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html diff --git a/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts b/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts index de9e68662d..23d75b7967 100644 --- a/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts +++ b/packages/zosfiles/src/methods/copy/doc/ICopyDatasetOptions.ts @@ -30,7 +30,7 @@ export interface ICopyDatasetOptions extends IZosFilesOptions { enq?: string; /** - * Replace option (DEPRECATED) + * Replace option * @type {boolean} */ replace?: boolean; From 0f41919540f89971fec413553a45cfa3e1f6f137 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 10:15:40 -0500 Subject: [PATCH 22/51] deferred promise format fix Signed-off-by: Pujal --- packages/cli/src/zosfiles/copy/ds/Ds.handler.ts | 3 ++- .../src/utilities/__tests__/DeferredPromise.unit.test.ts | 2 +- packages/imperative/src/utilities/src/DeferredPromise.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts index 4d81a1c3a9..40913a7d5c 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.handler.ts @@ -35,7 +35,8 @@ export default class DsHandler extends ZosFilesBaseHandler { private promptForSafeReplace(console: IHandlerResponseConsoleApi) { return async (targetDSN: string) => { const answer: string = await console.prompt( - `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss. Are you sure you want to continue? [y/N]: ` + `The dataset '${targetDSN}' exists on the target system. This copy will result in data loss.` + + ` Are you sure you want to continue? [y/N]: ` ); return answer != null && (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes"); }; diff --git a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts index 7e0806ce4a..7ab1cf1bbe 100644 --- a/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts +++ b/packages/imperative/src/utilities/__tests__/DeferredPromise.unit.test.ts @@ -1,4 +1,4 @@ -/** +/* * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html diff --git a/packages/imperative/src/utilities/src/DeferredPromise.ts b/packages/imperative/src/utilities/src/DeferredPromise.ts index fdcec4b54a..65324d0855 100644 --- a/packages/imperative/src/utilities/src/DeferredPromise.ts +++ b/packages/imperative/src/utilities/src/DeferredPromise.ts @@ -1,4 +1,4 @@ -/** +/* * This program and the accompanying materials are made available under the terms of the * Eclipse Public License v2.0 which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-v20.html From eae3449cd69acb58f51fdb5f71e956ca6937d2a1 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Fri, 17 Jan 2025 10:33:24 -0500 Subject: [PATCH 23/51] added amount of lines in jobdownload spool file system test Signed-off-by: jace-roell --- .../__tests__/__system__/DownloadJobs.system.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts index 53cc7337af..e64cf216a6 100644 --- a/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts @@ -315,6 +315,7 @@ describe("Download Jobs - System tests", () => { expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); + expect(IO.readFileSync(expectedFile).toString().trim().split('\n').length).toEqual(6); }); it("should be able to download all DDs from job output with a record range (2-8)", async () => { @@ -341,6 +342,7 @@ describe("Download Jobs - System tests", () => { expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); expect(IO.readFileSync(expectedFile).toString()).not.toContain("J E S 2 J O B L O G"); expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); + expect(IO.readFileSync(expectedFile).toString().trim().split('\n').length).toEqual(7); }); it("should be able to download all DDs from job output with a record range (0-100)", async () => { @@ -368,6 +370,7 @@ describe("Download Jobs - System tests", () => { expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); expect(IO.readFileSync(expectedFile).toString()).toContain("0------ JES2 JOB STATISTICS ------"); expect(IO.readFileSync(expectedFile).toString()).toContain("MINUTES EXECUTION TIME"); + expect(IO.readFileSync(expectedFile).toString().trim().split('\n').length).toEqual(16); //only 16 records in spool file }); }); @@ -730,6 +733,7 @@ describe("Download Jobs - System tests - Encoded", () => { expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); + expect(IO.readFileSync(expectedFile).toString().trim().split('\n').length).toEqual(6); }); it("should be able to download all DDs from job output with a record range (2-8) - encoded", async () => { @@ -756,6 +760,7 @@ describe("Download Jobs - System tests - Encoded", () => { expect(IO.readFileSync(expectedFile).toString()).toBeDefined(); expect(IO.readFileSync(expectedFile).toString()).not.toContain("J E S 2 J O B L O G"); expect(IO.readFileSync(expectedFile).toString()).not.toContain("0------ JES2 JOB STATISTICS ------"); + expect(IO.readFileSync(expectedFile).toString().trim().split('\n').length).toEqual(7); }); it("should be able to download all DDs from job output with a record range (0-100) - encoded", async () => { @@ -783,6 +788,7 @@ describe("Download Jobs - System tests - Encoded", () => { expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); expect(IO.readFileSync(expectedFile).toString()).toContain("0------ JES2 JOB STATISTICS ------"); expect(IO.readFileSync(expectedFile).toString()).toContain("MINUTES EXECUTION TIME"); + expect(IO.readFileSync(expectedFile).toString().trim().split('\n').length).toEqual(16); //only 16 records in spool file }); }); }); From e81d36d5b026c3681efb3fce8aaa97c603ed2e09 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Fri, 17 Jan 2025 10:39:52 -0500 Subject: [PATCH 24/51] linting Signed-off-by: jace-roell --- .../zosjobs/__tests__/__system__/DownloadJobs.system.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts index e64cf216a6..0d2c767f13 100644 --- a/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/DownloadJobs.system.test.ts @@ -788,7 +788,7 @@ describe("Download Jobs - System tests - Encoded", () => { expect(IO.readFileSync(expectedFile).toString()).toContain("J E S 2 J O B L O G"); expect(IO.readFileSync(expectedFile).toString()).toContain("0------ JES2 JOB STATISTICS ------"); expect(IO.readFileSync(expectedFile).toString()).toContain("MINUTES EXECUTION TIME"); - expect(IO.readFileSync(expectedFile).toString().trim().split('\n').length).toEqual(16); //only 16 records in spool file + expect(IO.readFileSync(expectedFile).toString().trim().split('\n').length).toEqual(16); //only 16 records in spool file }); }); }); From 6f70fd0f62caeb11c1269d67308ed4c401754edf Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 10:54:01 -0500 Subject: [PATCH 25/51] imperative changelog update Signed-off-by: Pujal --- packages/imperative/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 059c83a266..6d269b63d1 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to the Imperative package will be documented in this file. +## Recent Changes +- Format fix: `DeferredPromise` and `DeferredPromise.unit.test` comment format changed to match standard. + ## `8.11.0` - Enhancement: Added `DeferredPromise` class to Imperative to provide utilities for data synchronization. [#2405](https://github.com/zowe/zowe-cli/pull/2405) From 61ae6859e591f90c7e0ce0a58e5543b9a9509055 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 13:57:48 -0500 Subject: [PATCH 26/51] removed promptFn from ICrossLparCopyDataSetOptions.ts Signed-off-by: Pujal --- .../src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/zosfiles/src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts b/packages/zosfiles/src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts index 67eb680818..dc954fe028 100644 --- a/packages/zosfiles/src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts +++ b/packages/zosfiles/src/methods/copy/doc/ICrossLparCopyDatasetOptions.ts @@ -44,11 +44,4 @@ export interface ICrossLparCopyDatasetOptions extends ICopyDatasetOptions { * @type {boolean} */ overwrite?: boolean; - - /** - * Prompt callback that will be invoked before overwiting a data set. - * @param targetDSN Name of data set that already exists - * @returns True if target data set should be overwritten - */ - promptFn?: (targetDSN: string) => Promise; } From b6a671a104d2f43e4be138a75bcd86a35caf6188 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 16:01:17 -0500 Subject: [PATCH 27/51] updated changelogs Signed-off-by: Pujal --- packages/cli/CHANGELOG.md | 2 +- packages/zosfiles/CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 84d227ac06..51fc3ad646 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes -- BugFix: Added a `--safe-replace` option that prompts the user to confirm overwriting the contents of the target data set. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) +- BugFix: The `zowe zos-files copy data-set` command overwrites the contents of the target data set without user confirmation. A `--safe-replace` option was added which prompts the user to confirm before overwriting the contents of the target data set. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## Recent Changes - Enhancement: The `zowe zos-files copy data-set` command no longer requires the target data set to be preallocated. [##2349] (https://github.com/zowe/zowe-cli/issues/2349) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index f383845b5e..8b0d9495a9 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes -- Bug Fix: The `Copy.data.set` function now prompts the user to confirm overwriting the contents of the target data set with the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) +- Bug Fix: The `Copy.data.set` function now prompts the user to confirm before overwriting the contents of the target data set with addition of the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## Recent Changes - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) From 98cdedbd4cbed1bfc2c0161975ef0502f67a0898 Mon Sep 17 00:00:00 2001 From: Pujal Date: Fri, 17 Jan 2025 16:01:46 -0500 Subject: [PATCH 28/51] updated changelogs Signed-off-by: Pujal --- packages/zosfiles/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 8b0d9495a9..fec4b4770d 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes -- Bug Fix: The `Copy.data.set` function now prompts the user to confirm before overwriting the contents of the target data set with addition of the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) +- Bug Fix: The `Copy.data.set` function now prompts the user to confirm before overwriting the contents of the target data set with the addition of the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## Recent Changes - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) From 7bbb5c5e20da038e8a94b19c04365600361c7f4b Mon Sep 17 00:00:00 2001 From: Pujal Date: Tue, 21 Jan 2025 15:22:42 -0500 Subject: [PATCH 29/51] updated code coverage for handler Signed-off-by: Pujal --- .../__unit__/copy/ds/Ds.handler.unit.test.ts | 38 ++++++++++++++++++- .../__unit__/methods/copy/Copy.unit.test.ts | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts index 7f394f43fe..bbf9abfdfe 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts @@ -160,11 +160,47 @@ describe("DsHandler", () => { "from-dataset": { dsn: commandParameters.arguments.fromDataSetName }, "enq": commandParameters.arguments.enq, "replace": commandParameters.arguments.replace, - "reseponseTimeout": commandParameters.arguments.responseTimeout, + "responseTimeout": commandParameters.arguments.responseTimeout, "safeReplace": commandParameters.arguments.safeReplace, "promptFn": expect.any(Function) } ); expect(response).toBe(defaultReturn); }); + it("should prompt the user and return true when input is 'y'", async () => { + const handler = new DsHandler(); + + expect(handler).toBeInstanceOf(ZosFilesBaseHandler); + const fromDataSetName = "ABCD"; + const toDataSetName = "EFGH"; + const enq = "SHR"; + const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; + + const commandParameters: any = { + arguments: { + fromDataSetName, + toDataSetName, + enq, + replace, + safeReplace, + responseTimeout + }, + response: { + console: { promptFn: jest.fn() } + } + }; + const promptMock = jest.fn(); + promptMock.mockResolvedValue("y"); + + const promptFn = (handler as any)["promptForSafeReplace"]({ prompt: promptMock }); + const result = await promptFn(commandParameters.arguments.toDataSetName); + + expect(promptMock).toHaveBeenCalledWith( + "The dataset 'EFGH' exists on the target system. This copy will result in data loss." + + " Are you sure you want to continue? [y/N]: " + ); + expect(result).toBe(true); + }); }); diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 7934c7df05..9fa1cea7e1 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -471,6 +471,7 @@ describe("Copy", () => { safeReplace: true, promptFn } ); + expect(copyExpectStringSpy).toHaveBeenCalledTimes(1); const argumentsOfCall = copyExpectStringSpy.mock.calls[0]; const lastArgumentOfCall = argumentsOfCall[argumentsOfCall.length - 1]; @@ -491,7 +492,6 @@ describe("Copy", () => { )).rejects.toThrow(new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAborted.message })); expect(promptFn).toHaveBeenCalledWith(toDataSetName); - }); it("should not throw error if safeReplace has value of false", async () => { From 12827c9188e37fedfb0d3a39974139ec047c700b Mon Sep 17 00:00:00 2001 From: Pujal Date: Tue, 21 Jan 2025 16:30:05 -0500 Subject: [PATCH 30/51] updated handler unit test Signed-off-by: Pujal --- .../__unit__/copy/ds/Ds.handler.unit.test.ts | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts index bbf9abfdfe..2975ad8629 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/Ds.handler.unit.test.ts @@ -198,9 +198,45 @@ describe("DsHandler", () => { const result = await promptFn(commandParameters.arguments.toDataSetName); expect(promptMock).toHaveBeenCalledWith( - "The dataset 'EFGH' exists on the target system. This copy will result in data loss." + - " Are you sure you want to continue? [y/N]: " + `The dataset '${toDataSetName}' exists on the target system. This copy will result in data loss.` + + ` Are you sure you want to continue? [y/N]: ` ); expect(result).toBe(true); }); + it("should prompt the user and return true when input is 'N'", async () => { + const handler = new DsHandler(); + + expect(handler).toBeInstanceOf(ZosFilesBaseHandler); + const fromDataSetName = "ABCD"; + const toDataSetName = "EFGH"; + const enq = "SHR"; + const replace = true; + const safeReplace = true; + const responseTimeout: any = undefined; + + const commandParameters: any = { + arguments: { + fromDataSetName, + toDataSetName, + enq, + replace, + safeReplace, + responseTimeout + }, + response: { + console: { promptFn: jest.fn() } + } + }; + const promptMock = jest.fn(); + promptMock.mockResolvedValue("N"); + + const promptFn = (handler as any)["promptForSafeReplace"]({ prompt: promptMock }); + const result = await promptFn(commandParameters.arguments.toDataSetName); + + expect(promptMock).toHaveBeenCalledWith( + `The dataset '${toDataSetName}' exists on the target system. This copy will result in data loss.` + + ` Are you sure you want to continue? [y/N]: ` + ); + expect(result).toBe(false); + }); }); From 27c9e8336469256066b83006370850d3785482c7 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 22 Jan 2025 14:51:57 -0500 Subject: [PATCH 31/51] init Signed-off-by: jace-roell --- packages/zosfiles/src/methods/copy/Copy.ts | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index 402738f0ce..a7cb9656e3 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -272,7 +272,7 @@ export class Copy { /* * If the source is a PDS and no member was specified then abort the copy. */ - if((sourceDataSetObj.dsorg == "PO" || sourceDataSetObj.dsorg == "POE") && sourceMember == undefined){ + if((sourceDataSetObj.dsorg == "PO" || sourceDataSetObj.dsorg == "PO-E") && sourceMember == undefined){ throw new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAbortedNoPDS.message }); } } @@ -316,7 +316,7 @@ export class Copy { targetDataSetObj = TargetDsList.apiResponse.items[dsnameIndex]; targetFound = true; - if((targetDataSetObj.dsorg == "PO" || targetDataSetObj.dsorg == "POE") && targetMember == undefined) + if((targetDataSetObj.dsorg == "PO" || targetDataSetObj.dsorg == "PO-E") && targetMember == undefined) { throw new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAbortedTargetNotPDSMember.message }); } @@ -346,11 +346,11 @@ export class Copy { * If this is a PDS but the target is the sequential dataset and does not exist, * create a new sequential dataset with the same parameters as the original PDS. */ - if((createOptions.dsorg == "PO" || createOptions.dsorg == "POE") && targetMember == undefined){ + if((createOptions.dsorg == "PO" || createOptions.dsorg == "PO-E") && targetMember == undefined){ createOptions.dsorg ="PS"; createOptions.dirblk = 0; } - else if(targetMember != undefined && (createOptions.dsorg != "PO" && createOptions.dsorg != "POE")) + else if(targetMember != undefined && (createOptions.dsorg != "PO" && createOptions.dsorg != "PO-E")) { createOptions.dsorg ="PO"; createOptions.dirblk = 1; @@ -419,21 +419,21 @@ export class Copy { storclass: targetOptions.targetStorageClass, mgntclass: targetOptions.targetManagementClass, dataclass: targetOptions.targetDataClass, - dirblk: parseInt(dsInfo.dsorg == "PO" || dsInfo.dsorg == "POE" ? "10" : "0") + dirblk: parseInt(dsInfo.dsorg == "PO" || dsInfo.dsorg == "PO-E" ? "10" : "0") })); } /** - * Private function to convert the ALC value from the format returned by the Get() call in to the format used by the Create() call + * Converts the ALC value from the format returned by the Get() call to the format used by the Create() call. + * @param {string} getValue - The ALC value from the Get() call. + * @returns {string} - The ALC value in the format used by the Create() call. */ - private static convertAlcTozOSMF( zosmfValue: string): string { - /** - * Create dataset only accepts tracks or cylinders as allocation units. - * When the get() call retreives the dataset info, it will convert size - * allocations of the other unit types in to tracks. So we will always - * allocate the new target in tracks. - */ - return "TRK"; + private static convertAlcTozOSMF(getValue: string): string { + const alcMap: Record = { + "TRACK": "TRK", + "CYLINDERS": "CYL" + }; + return alcMap[getValue.toUpperCase()] || "TRK"; } } From c18ac0b0dac2077af99174a14b999b225af56423 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Thu, 23 Jan 2025 12:20:06 -0500 Subject: [PATCH 32/51] dataset list attributes Signed-off-by: jace-roell --- .../__tests__/__system__/methods/copy/Copy.system.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index bccc37a439..eaec5f5830 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -22,6 +22,7 @@ import { ITestEnvironment } from "../../../../../../__tests__/__src__/environmen import { tmpdir } from "os"; import path = require("path"); import * as fs from "fs"; +import { List } from "@zowe/zos-files-for-zowe-sdk" let REAL_SESSION: Session; let REAL_TARGET_SESSION: Session; @@ -895,6 +896,7 @@ describe("Copy", () => { let error: any; let response: IZosFilesResponse | undefined = undefined; let contents: Buffer; + let listAttributes; const TEST_TARGET_SESSION = REAL_TARGET_SESSION; const toDataset: IDataSet = { dsn: toDataSetName, member: file1 }; const fromOptions: IGetOptions = { @@ -909,11 +911,14 @@ describe("Copy", () => { }; const toDataSetString = `${toDataset.dsn}(${toDataset.member})`; try { + listAttributes = (await List.dataSet(REAL_SESSION, fromDataSetName, {attributes: true})).apiResponse.items; response = await Copy.dataSetCrossLPAR(REAL_SESSION, toDataset, options, fromOptions, TEST_TARGET_SESSION); contents = await Get.dataSet(TEST_TARGET_SESSION, toDataSetString); } catch (err) { error = err; } + + expect(listAttributes[0].spacu).toEqual("CYLINDERS"); expect(response?.success).toBeTruthy(); expect(error).not.toBeDefined(); expect(response?.errorMessage).not.toBeDefined(); From dc3efd1dcd1e4676f34db710a2e631a9ccc3d4ba Mon Sep 17 00:00:00 2001 From: jace-roell Date: Fri, 24 Jan 2025 10:48:26 -0500 Subject: [PATCH 33/51] unit tests, changelog, linting, system tests Signed-off-by: jace-roell --- packages/zosfiles/CHANGELOG.md | 1 + .../methods/copy/Copy.system.test.ts | 78 +++++++++++++- .../__unit__/methods/copy/Copy.unit.test.ts | 100 ++++++++++++++++++ packages/zosfiles/src/methods/copy/Copy.ts | 2 +- 4 files changed, 175 insertions(+), 6 deletions(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 7ade7108f7..a6a8303d86 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in thi ## Recent Changes +- Fixed an issue in the Copy.dataSetCrossLPAR() function where the `spacu` attribute of the copied data set was always set to `TRK`, regardless of the source data set's attributes. [#2412](https://github.com/zowe/zowe-cli/issues/2412) - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) - Enhancement: Added the `maxLength` option to List SDK functions (`allMembers`, `dataSetsMatchingPattern`, `membersMatchingPattern`) to specify the maximum number of items to return. [#2409](https://github.com/zowe/zowe-cli/pull/2409) - Enhancement: Added the `start` option to List SDK functions (`allMembers`, `dataSetsMatchingPattern`, `membersMatchingPattern`) to specify the first data set/member name to return in the response. [#2409](https://github.com/zowe/zowe-cli/pull/2409) diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index eaec5f5830..e80fdd98fb 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -22,7 +22,7 @@ import { ITestEnvironment } from "../../../../../../__tests__/__src__/environmen import { tmpdir } from "os"; import path = require("path"); import * as fs from "fs"; -import { List } from "@zowe/zos-files-for-zowe-sdk" +import { List } from "@zowe/zos-files-for-zowe-sdk"; let REAL_SESSION: Session; let REAL_TARGET_SESSION: Session; @@ -30,6 +30,8 @@ let testEnvironment: ITestEnvironment; let defaultSystem: ITestPropertiesSchema; let defaultTargetSystem: ITestPropertiesSchema; let fromDataSetName: string; +let fromDataSetNameTracks: string; +let fromDataSetNameCylinders: string; let toDataSetName: string; const file1 = "file1"; @@ -45,6 +47,8 @@ describe("Copy", () => { REAL_SESSION = TestEnvironment.createZosmfSession(testEnvironment); REAL_TARGET_SESSION = REAL_SESSION; fromDataSetName = `${defaultSystem.zosmf.user.trim().toUpperCase()}.DATA.ORIGINAL`; + fromDataSetNameTracks = `${defaultSystem.zosmf.user.trim().toUpperCase()}.DATA.TRKORG`; + fromDataSetNameCylinders = `${defaultSystem.zosmf.user.trim().toUpperCase()}.DATA.CYLORG`; toDataSetName = `${defaultSystem.zosmf.user.trim().toUpperCase()}.DATA.COPY`; }); @@ -654,7 +658,7 @@ describe("Copy", () => { responseTimeout: 5, replace: false }; - try { + try { response = await Copy.dataSetCrossLPAR(REAL_SESSION, toDataset, options, fromOptions, TEST_TARGET_SESSION); contents = await Get.dataSet(TEST_TARGET_SESSION, toDataSetName); } catch (err) { @@ -892,7 +896,14 @@ describe("Copy", () => { }); describe("Success cases", () => { - it("should copy the source to the destination data set and allocate the dataset", async() => { + it("should copy the source to the destination data set and allocate the dataset - CYLINDERS", async() => { + try { + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_SEQUENTIAL, fromDataSetNameCylinders, {alcunit: "CYL"}); + await Upload.fileToDataset(REAL_SESSION, fileLocation, fromDataSetNameCylinders); + } catch (err) { + Imperative.console.info(`Error: ${inspect(err)}`); + } + let error: any; let response: IZosFilesResponse | undefined = undefined; let contents: Buffer; @@ -905,13 +916,13 @@ describe("Copy", () => { record: false }; const options: ICrossLparCopyDatasetOptions = { - "from-dataset": { dsn: fromDataSetName }, + "from-dataset": { dsn: fromDataSetNameCylinders }, responseTimeout: 5, replace: false }; const toDataSetString = `${toDataset.dsn}(${toDataset.member})`; try { - listAttributes = (await List.dataSet(REAL_SESSION, fromDataSetName, {attributes: true})).apiResponse.items; + listAttributes = (await List.dataSet(REAL_SESSION, fromDataSetNameCylinders, {attributes: true})).apiResponse.items; response = await Copy.dataSetCrossLPAR(REAL_SESSION, toDataset, options, fromOptions, TEST_TARGET_SESSION); contents = await Get.dataSet(TEST_TARGET_SESSION, toDataSetString); } catch (err) { @@ -924,6 +935,63 @@ describe("Copy", () => { expect(response?.errorMessage).not.toBeDefined(); expect(response?.commandResponse).toContain("Data set copied successfully"); expect(contents.toString().trim()).toBe(readFileSync(fileLocation).toString()); + + try { + await Delete.dataSet(REAL_SESSION, fromDataSetNameCylinders); + await Delete.dataSet(REAL_SESSION, toDataSetName); + } catch (err) { + Imperative.console.info(`Error: ${inspect(err)}`); + } + }); + + it("should copy the source to the destination data set and allocate the dataset - TRACKS", async() => { + try { + await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_SEQUENTIAL, fromDataSetNameTracks, {alcunit: "TRK"}); + await Upload.fileToDataset(REAL_SESSION, fileLocation, fromDataSetNameTracks); + } catch (err) { + Imperative.console.info(`Error: ${inspect(err)}`); + } + + let error: any; + let response: IZosFilesResponse | undefined = undefined; + let contents: Buffer; + let listAttributes; + const TEST_TARGET_SESSION = REAL_TARGET_SESSION; + + // Append "1" such that it is not an existing data set and thus will reach generateDatasetOptions() within Copy.ts + const toDataset: IDataSet = { dsn: toDataSetName, member: file1 }; + const fromOptions: IGetOptions = { + binary: false, + encoding: undefined, + record: false + }; + const options: ICrossLparCopyDatasetOptions = { + "from-dataset": { dsn: fromDataSetNameTracks }, + responseTimeout: 5, + replace: false + }; + const toDataSetString = `${toDataset.dsn}(${toDataset.member})`; + try { + listAttributes = (await List.dataSet(REAL_SESSION, fromDataSetNameTracks, {attributes: true})).apiResponse.items; + response = await Copy.dataSetCrossLPAR(REAL_SESSION, toDataset, options, fromOptions, TEST_TARGET_SESSION); + contents = await Get.dataSet(TEST_TARGET_SESSION, toDataSetString); + } catch (err) { + error = err; + } + + expect(listAttributes[0].spacu).toEqual("TRACKS"); + expect(response?.success).toBeTruthy(); + expect(error).not.toBeDefined(); + expect(response?.errorMessage).not.toBeDefined(); + expect(response?.commandResponse).toContain("Data set copied successfully"); + expect(contents.toString().trim()).toBe(readFileSync(fileLocation).toString()); + + try { + await Delete.dataSet(REAL_SESSION, fromDataSetNameTracks); + await Delete.dataSet(REAL_SESSION, toDataSetName); + } catch (err) { + Imperative.console.info(`Error: ${inspect(err)}`); + } }); it("should overwrite the destination data set member", async() => { diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index e6de696ef0..50b5aa007e 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -807,6 +807,7 @@ describe("Copy", () => { const listAllMembersSpy = jest.spyOn(List, "allMembers"); const createDatasetSpy = jest.spyOn(Create, "dataSet"); const uploadDatasetSpy = jest.spyOn(Upload, "bufferToDataSet"); + const psDataSetName = "TEST.PS.DATA.SET"; const memberName = "mem1"; const poDataSetName = "TEST.PO.DATA.SET"; @@ -826,6 +827,12 @@ describe("Copy", () => { spacu: "TRK" }; + const dataSetPOCYL = { + dsname: poDataSetName, + dsorg: "PO", + spacu: "CYL" + }; + beforeEach(() => { getDatasetSpy.mockClear(); listDatasetSpy.mockClear(); @@ -959,6 +966,99 @@ describe("Copy", () => { expect(uploadDatasetSpy).toHaveBeenCalledTimes(1); }); + it("should send a request - TRK and validate spacu", async () => { + let response; + let caughtError; + + listDatasetSpy.mockImplementation(async (): Promise => { + return { + apiResponse: { + returnedRows: 1, + items: [dataSetPO], + } + }; + }); + + listAllMembersSpy.mockImplementation(async (): Promise => { + return { + apiResponse: { + returnedRows: 1 + } + }; + }); + + try { + response = await Copy.dataSetCrossLPAR( + dummySession, + { dsn: poDataSetName, member: memberName }, + { "from-dataset": { dsn: poDataSetName, member: memberName }, replace: true }, + {}, + dummySession + ); + } catch (e) { + caughtError = e; + } + + // Assertions + expect(response).toEqual({ + success: true, + commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message + }); + + expect(listDatasetSpy).toHaveBeenCalledTimes(2); + expect(listAllMembersSpy).toHaveBeenCalledTimes(1); + expect(listAllMembersSpy.mock.calls[0][2].start).toBe(memberName); + expect(getDatasetSpy).toHaveBeenCalledTimes(1); + expect(uploadDatasetSpy).toHaveBeenCalledTimes(1); + expect(dataSetPO.spacu).toBe("TRK"); + }); + + it("should send a request - CYL and validate spacu", async () => { + let response; + let caughtError; + + listDatasetSpy.mockImplementation(async (): Promise => { + return { + apiResponse: { + returnedRows: 1, + items: [dataSetPOCYL], + } + }; + }); + + listAllMembersSpy.mockImplementation(async (): Promise => { + return { + apiResponse: { + returnedRows: 1 + } + }; + }); + + try { + response = await Copy.dataSetCrossLPAR( + dummySession, + { dsn: poDataSetName, member: memberName }, + { "from-dataset": { dsn: poDataSetName, member: memberName }, replace: true }, + {}, + dummySession + ); + } catch (e) { + caughtError = e; + } + + expect(response).toEqual({ + success: true, + commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message + }); + + expect(listDatasetSpy).toHaveBeenCalledTimes(2); + expect(listAllMembersSpy).toHaveBeenCalledTimes(1); + expect(listAllMembersSpy.mock.calls[0][2].start).toBe(memberName); + expect(getDatasetSpy).toHaveBeenCalledTimes(1); + expect(uploadDatasetSpy).toHaveBeenCalledTimes(1); + expect(dataSetPOCYL.spacu).toBe("CYL"); + }); + describe("Sequential > Member", () => { it("should send a request", async () => { let response; diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index bf9a256d78..185531b5d4 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -430,7 +430,7 @@ export class Copy { */ private static convertAlcTozOSMF(getValue: string): string { const alcMap: Record = { - "TRACK": "TRK", + "TRACKS": "TRK", "CYLINDERS": "CYL" }; return alcMap[getValue.toUpperCase()] || "TRK"; From f2ea88230224c9f0859e0dcde6b8b96af1a5bfc7 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Fri, 24 Jan 2025 11:08:10 -0500 Subject: [PATCH 34/51] unused var Signed-off-by: jace-roell --- .../__tests__/__unit__/methods/copy/Copy.unit.test.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 50b5aa007e..ad87455bd8 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -850,7 +850,6 @@ describe("Copy", () => { describe("Sequential > Sequential", () => { it("should send a request", async () => { let response; - let caughtError; listDatasetSpy.mockImplementation(async (): Promise => { return { @@ -872,9 +871,7 @@ describe("Copy", () => { { }, dummySession ); - } catch (e) { - caughtError = e; - } + } catch{} expect(response).toEqual({ success: true, @@ -912,9 +909,7 @@ describe("Copy", () => { { }, dummySession ); - } catch (e) { - caughtError = e; - } + } catch{} expect(listDatasetSpy).toHaveBeenCalledTimes(2); expect(getDatasetSpy).toHaveBeenCalledTimes(1); From 1f123d86924350b4f69617656222f104738de6e0 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Fri, 24 Jan 2025 11:24:16 -0500 Subject: [PATCH 35/51] linting Signed-off-by: jace-roell --- .../methods/copy/Copy.system.test.ts | 2 +- .../__unit__/methods/copy/Copy.unit.test.ts | 38 ++++++++----------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index e80fdd98fb..27652eea7b 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -658,7 +658,7 @@ describe("Copy", () => { responseTimeout: 5, replace: false }; - try { + try { response = await Copy.dataSetCrossLPAR(REAL_SESSION, toDataset, options, fromOptions, TEST_TARGET_SESSION); contents = await Get.dataSet(TEST_TARGET_SESSION, toDataSetName); } catch (err) { diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index ad87455bd8..0c557eaf02 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -849,8 +849,6 @@ describe("Copy", () => { describe("Success Scenarios", () => { describe("Sequential > Sequential", () => { it("should send a request", async () => { - let response; - listDatasetSpy.mockImplementation(async (): Promise => { return { apiResponse: { @@ -863,15 +861,14 @@ describe("Copy", () => { return Buffer.from("123456789abcd"); }); - try { - response = await Copy.dataSetCrossLPAR( - dummySession, - { dsn: psDataSetName }, - { "from-dataset": { dsn: dataSetPS.dsname }, replace: true}, - { }, - dummySession - ); - } catch{} + + const response = await Copy.dataSetCrossLPAR( + dummySession, + { dsn: psDataSetName }, + { "from-dataset": { dsn: dataSetPS.dsname }, replace: true}, + { }, + dummySession + ); expect(response).toEqual({ success: true, @@ -886,9 +883,6 @@ describe("Copy", () => { describe("Sequential > Sequential - no replace", () => { it("should send a request", async () => { - let response; - let caughtError; - listDatasetSpy.mockImplementation(async (): Promise => { return { apiResponse: { @@ -901,15 +895,13 @@ describe("Copy", () => { return Buffer.from("123456789abcd"); }); - try { - response = await Copy.dataSetCrossLPAR( - dummySession, - { dsn: psDataSetName }, - { "from-dataset": { dsn: dataSetPS.dsname }, replace: false}, - { }, - dummySession - ); - } catch{} + const response = await Copy.dataSetCrossLPAR( + dummySession, + { dsn: psDataSetName }, + { "from-dataset": { dsn: dataSetPS.dsname }, replace: false}, + { }, + dummySession + ); expect(listDatasetSpy).toHaveBeenCalledTimes(2); expect(getDatasetSpy).toHaveBeenCalledTimes(1); From d53ba7bb106bb96f37fa388a5c325e0b219a3c70 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Fri, 24 Jan 2025 11:38:04 -0500 Subject: [PATCH 36/51] linting Signed-off-by: jace-roell --- .../__unit__/methods/copy/Copy.unit.test.ts | 63 +++++++------------ 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 0c557eaf02..590d8ab3a0 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -895,7 +895,7 @@ describe("Copy", () => { return Buffer.from("123456789abcd"); }); - const response = await Copy.dataSetCrossLPAR( + await Copy.dataSetCrossLPAR( dummySession, { dsn: psDataSetName }, { "from-dataset": { dsn: dataSetPS.dsname }, replace: false}, @@ -955,7 +955,6 @@ describe("Copy", () => { it("should send a request - TRK and validate spacu", async () => { let response; - let caughtError; listDatasetSpy.mockImplementation(async (): Promise => { return { @@ -974,17 +973,12 @@ describe("Copy", () => { }; }); - try { - response = await Copy.dataSetCrossLPAR( - dummySession, - { dsn: poDataSetName, member: memberName }, - { "from-dataset": { dsn: poDataSetName, member: memberName }, replace: true }, - {}, - dummySession - ); - } catch (e) { - caughtError = e; - } + await Copy.dataSetCrossLPAR( + dummySession, + { dsn: poDataSetName, member: memberName }, + { "from-dataset": { dsn: poDataSetName, member: memberName }, replace: true }, + {}, + dummySession); // Assertions expect(response).toEqual({ @@ -1001,9 +995,6 @@ describe("Copy", () => { }); it("should send a request - CYL and validate spacu", async () => { - let response; - let caughtError; - listDatasetSpy.mockImplementation(async (): Promise => { return { apiResponse: { @@ -1021,17 +1012,15 @@ describe("Copy", () => { }; }); - try { - response = await Copy.dataSetCrossLPAR( - dummySession, - { dsn: poDataSetName, member: memberName }, - { "from-dataset": { dsn: poDataSetName, member: memberName }, replace: true }, - {}, - dummySession - ); - } catch (e) { - caughtError = e; - } + + const response = await Copy.dataSetCrossLPAR( + dummySession, + { dsn: poDataSetName, member: memberName }, + { "from-dataset": { dsn: poDataSetName, member: memberName }, replace: true }, + {}, + dummySession + ); + expect(response).toEqual({ success: true, @@ -1048,7 +1037,6 @@ describe("Copy", () => { describe("Sequential > Member", () => { it("should send a request", async () => { - let response; let caughtError; listDatasetSpy.mockReturnValueOnce({ @@ -1070,17 +1058,14 @@ describe("Copy", () => { }; }); - try { - response = await Copy.dataSetCrossLPAR( - dummySession, - { dsn: poDataSetName, member: memberName }, - { "from-dataset": { dsn: psDataSetName }, replace: true}, - { }, - dummySession - ); - } catch (e) { - caughtError = e; - } + const response = await Copy.dataSetCrossLPAR( + dummySession, + { dsn: poDataSetName, member: memberName }, + { "from-dataset": { dsn: psDataSetName }, replace: true}, + { }, + dummySession + ); + expect(response).toEqual({ success: true, From ee5c0b778bd032f2a398c724f1d1733f98800d31 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Fri, 24 Jan 2025 11:56:29 -0500 Subject: [PATCH 37/51] fix test Signed-off-by: jace-roell --- .../__unit__/methods/copy/Copy.unit.test.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts index 590d8ab3a0..ea3ef20496 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts @@ -883,6 +883,7 @@ describe("Copy", () => { describe("Sequential > Sequential - no replace", () => { it("should send a request", async () => { + let caughtError; listDatasetSpy.mockImplementation(async (): Promise => { return { apiResponse: { @@ -895,14 +896,19 @@ describe("Copy", () => { return Buffer.from("123456789abcd"); }); - await Copy.dataSetCrossLPAR( - dummySession, - { dsn: psDataSetName }, - { "from-dataset": { dsn: dataSetPS.dsname }, replace: false}, - { }, - dummySession - ); + try { + await Copy.dataSetCrossLPAR( + dummySession, + { dsn: psDataSetName }, + { "from-dataset": { dsn: dataSetPS.dsname }, replace: false}, + { }, + dummySession + ); + } catch (e) { + caughtError = e; + } + expect(caughtError).toBeDefined(); expect(listDatasetSpy).toHaveBeenCalledTimes(2); expect(getDatasetSpy).toHaveBeenCalledTimes(1); expect(uploadDatasetSpy).toHaveBeenCalledTimes(0); @@ -954,8 +960,6 @@ describe("Copy", () => { }); it("should send a request - TRK and validate spacu", async () => { - let response; - listDatasetSpy.mockImplementation(async (): Promise => { return { apiResponse: { @@ -973,7 +977,7 @@ describe("Copy", () => { }; }); - await Copy.dataSetCrossLPAR( + const response = await Copy.dataSetCrossLPAR( dummySession, { dsn: poDataSetName, member: memberName }, { "from-dataset": { dsn: poDataSetName, member: memberName }, replace: true }, From f63bab611c4eca1c76cbd736815b467ba776775b Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 29 Jan 2025 14:38:41 -0500 Subject: [PATCH 38/51] changelog Signed-off-by: jace-roell --- packages/zosfiles/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index a6a8303d86..10dc1cfd18 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in thi ## Recent Changes -- Fixed an issue in the Copy.dataSetCrossLPAR() function where the `spacu` attribute of the copied data set was always set to `TRK`, regardless of the source data set's attributes. [#2412](https://github.com/zowe/zowe-cli/issues/2412) +- Fixed an issue in the `Copy.dataSetCrossLPAR()` function where the `spacu` attribute of the copied data set was always set to `TRK`, regardless of the source data set's attributes. [#2412](https://github.com/zowe/zowe-cli/issues/2412) - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) - Enhancement: Added the `maxLength` option to List SDK functions (`allMembers`, `dataSetsMatchingPattern`, `membersMatchingPattern`) to specify the maximum number of items to return. [#2409](https://github.com/zowe/zowe-cli/pull/2409) - Enhancement: Added the `start` option to List SDK functions (`allMembers`, `dataSetsMatchingPattern`, `membersMatchingPattern`) to specify the first data set/member name to return in the response. [#2409](https://github.com/zowe/zowe-cli/pull/2409) From 9c95fa5460b8670f641cd6d3c96cd553bd8d8b26 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 29 Jan 2025 14:44:13 -0500 Subject: [PATCH 39/51] changelog Signed-off-by: jace-roell --- packages/zosfiles/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index ab7a443b3f..9027ce8eaf 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. +## Recent Changes + +- Fixed an issue in the `Copy.dataSetCrossLPAR()` function where the `spacu` attribute of the copied data set was always set to `TRK`, regardless of the source data set's attributes. [#2412](https://github.com/zowe/zowe-cli/issues/2412) + ## `8.12.0` - Fixed an issue in the `Copy.dataSetCrossLPAR()` function where the `spacu` attribute of the copied data set was always set to `TRK`, regardless of the source data set's attributes. [#2412](https://github.com/zowe/zowe-cli/issues/2412) From 3fc5fb5fd2e7322022a66958ad90f5425e5c7fd2 Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 29 Jan 2025 15:38:07 -0500 Subject: [PATCH 40/51] data set copy aborted message fix - PR comment Signed-off-by: Pujal --- packages/zosfiles/src/constants/ZosFiles.messages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/src/constants/ZosFiles.messages.ts b/packages/zosfiles/src/constants/ZosFiles.messages.ts index 33d74079ec..9c4b9d8e7a 100644 --- a/packages/zosfiles/src/constants/ZosFiles.messages.ts +++ b/packages/zosfiles/src/constants/ZosFiles.messages.ts @@ -678,7 +678,7 @@ export const ZosFilesMessages: { [key: string]: IMessageDefinition } = { * @type {IMessageDefinition} */ datasetCopiedAborted: { - message: "Data set copied aborted. The existing target data set was not overwritten." + message: "Data set copy aborted. The existing target data set was not overwritten." }, /** From da4fe158602206898c3fe5154f641cae2d9bd9d2 Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:10:13 -0500 Subject: [PATCH 41/51] Update packages/cli/CHANGELOG.md Co-authored-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- packages/cli/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index a9cd026349..8bb8e266d1 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to the Zowe CLI package will be documented in this file. ## Recent Changes + - BugFix: The `zowe zos-files copy data-set` command overwrites the contents of the target data set without user confirmation. A `--safe-replace` option was added which prompts the user to confirm before overwriting the contents of the target data set. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## `8.12.0` From f21d2eaf44471759a223db030497ac2cb6dae10a Mon Sep 17 00:00:00 2001 From: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:10:36 -0500 Subject: [PATCH 42/51] Update packages/zosfiles/CHANGELOG.md Co-authored-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com> --- packages/zosfiles/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 84b4d226b3..ac0caa7519 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in this file. ## Recent Changes + - Bug Fix: The `Copy.data.set` function now prompts the user to confirm before overwriting the contents of the target data set with the addition of the `--safe-replace` option. [#2369] (https://github.com/zowe/zowe-cli/issues/2369) ## `8.12.0` From 68b2efb4b559f916221ed1a350664d04d0c0fff8 Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 29 Jan 2025 16:16:09 -0500 Subject: [PATCH 43/51] updated snapshot Signed-off-by: Pujal --- .../utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/__tests__/__unit__/utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap b/packages/zosfiles/__tests__/__unit__/utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap index 59245f88cb..61acd4749f 100644 --- a/packages/zosfiles/__tests__/__unit__/utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap +++ b/packages/zosfiles/__tests__/__unit__/utils/__snapshots__/ZosFilesUtils.unit.test.ts.snap @@ -85,7 +85,7 @@ Object { "message": "Data set allocation aborted. The \\"allocate like\\" data set was not found.", }, "datasetCopiedAborted": Object { - "message": "Data set copied aborted. The existing target data set was not overwritten.", + "message": "Data set copy aborted. The existing target data set was not overwritten.", }, "datasetCopiedAbortedNoPDS": Object { "message": "Data set copied aborted. Copying from a PDS to PDS is not supported when using the 'dsclp' option.", From 956f3a5f4f3c6e409bacb4c874a484d3f1a37ae2 Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 29 Jan 2025 16:26:51 -0500 Subject: [PATCH 44/51] updated --sr alias Signed-off-by: Pujal --- .../copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap | 1 + packages/cli/src/zosfiles/copy/ds/Ds.definition.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap index 0bc8ffcfc4..7e0c8a3fa9 100644 --- a/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__unit__/copy/ds/__snapshots__/Ds.definition.unit.test.ts.snap @@ -13,6 +13,7 @@ Array [ Object { "aliases": Array [ "safe-rep", + "--sr", ], "description": "Specify this option as true if you wish to replace like-named members or the content of the target data set. This option will prompt to confirm.", "name": "safe-replace", diff --git a/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts b/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts index 959be54458..a3d9cb4b28 100644 --- a/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts +++ b/packages/cli/src/zosfiles/copy/ds/Ds.definition.ts @@ -56,7 +56,7 @@ export const DsDefinition: ICommandDefinition = { }, { name: "safe-replace", - aliases: ["safe-rep"], + aliases: ["safe-rep", "--sr"], description: strings.OPTIONS.SAFE_REPLACE, type: "boolean", } From 02c3786f7ee5bd10192f5686ade5ad1539731836 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 29 Jan 2025 16:33:16 -0500 Subject: [PATCH 45/51] changelog, startsWith(), comments Signed-off-by: jace-roell --- packages/zosfiles/CHANGELOG.md | 1 - packages/zosfiles/src/methods/copy/Copy.ts | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/zosfiles/CHANGELOG.md b/packages/zosfiles/CHANGELOG.md index 9027ce8eaf..186ef43342 100644 --- a/packages/zosfiles/CHANGELOG.md +++ b/packages/zosfiles/CHANGELOG.md @@ -8,7 +8,6 @@ All notable changes to the Zowe z/OS files SDK package will be documented in thi ## `8.12.0` -- Fixed an issue in the `Copy.dataSetCrossLPAR()` function where the `spacu` attribute of the copied data set was always set to `TRK`, regardless of the source data set's attributes. [#2412](https://github.com/zowe/zowe-cli/issues/2412) - Enhancement: The `Copy.dataset` function now creates a new data set if the entered target data set does not exist. [#2349](https://github.com/zowe/zowe-cli/issues/2349) - Enhancement: Added the `maxLength` option to List SDK functions (`allMembers`, `dataSetsMatchingPattern`, `membersMatchingPattern`) to specify the maximum number of items to return. [#2409](https://github.com/zowe/zowe-cli/pull/2409) - Enhancement: Added the `start` option to List SDK functions (`allMembers`, `dataSetsMatchingPattern`, `membersMatchingPattern`) to specify the first data set/member name to return in the response. [#2409](https://github.com/zowe/zowe-cli/pull/2409) diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index 185531b5d4..cb7b56ef5e 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -272,7 +272,7 @@ export class Copy { /* * If the source is a PDS and no member was specified then abort the copy. */ - if((sourceDataSetObj.dsorg == "PO" || sourceDataSetObj.dsorg == "PO-E") && sourceMember == undefined){ + if((sourceDataSetObj.dsorg.startsWith("PO") || sourceDataSetObj.dsorg.startsWith("PO-E")) && sourceMember == undefined){ throw new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAbortedNoPDS.message }); } } @@ -429,6 +429,12 @@ export class Copy { * @returns {string} - The ALC value in the format used by the Create() call. */ private static convertAlcTozOSMF(getValue: string): string { + /** + * Create dataset only accepts tracks or cylinders as allocation units. + * When the get() call retreives the dataset info, it will convert size + * allocations of the other unit types in to tracks. So we will always + * allocate the new target in tracks. + */ const alcMap: Record = { "TRACKS": "TRK", "CYLINDERS": "CYL" From 2f15736aa03b291a1e14e11fc3b53741ac8779e7 Mon Sep 17 00:00:00 2001 From: Pujal Date: Wed, 29 Jan 2025 16:34:20 -0500 Subject: [PATCH 46/51] updated system tests Signed-off-by: Pujal --- .../__tests__/__system__/methods/copy/Copy.system.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts index db23bfe4fa..da8fd8b947 100644 --- a/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/copy/Copy.system.test.ts @@ -713,7 +713,7 @@ describe("Copy", () => { } expect(response?.success).toBeFalsy(); expect(error).toBeDefined(); - expect(error.message).toContain("Data set copied aborted. The existing target data set was not overwritten."); + expect(error.message).toContain("Data set copy aborted. The existing target data set was not overwritten."); }); }); @@ -853,7 +853,7 @@ describe("Copy", () => { } expect(response?.success).toBeFalsy(); expect(error).toBeDefined(); - expect(error.message).toContain("Data set copied aborted. The existing target data set was not overwritten."); + expect(error.message).toContain("Data set copy aborted. The existing target data set was not overwritten."); }); }); @@ -967,7 +967,7 @@ describe("Copy", () => { } expect(response?.success).toBeFalsy(); expect(error).toBeDefined(); - expect(error.message).toContain("Data set copied aborted. The existing target data set was not overwritten."); + expect(error.message).toContain("Data set copy aborted. The existing target data set was not overwritten."); }); }); @@ -1082,7 +1082,7 @@ describe("Copy", () => { } expect(response?.success).toBeFalsy(); expect(error).toBeDefined(); - expect(error.message).toContain("Data set copied aborted. The existing target data set was not overwritten."); + expect(error.message).toContain("Data set copy aborted. The existing target data set was not overwritten."); }); }); From 2d40140bd234405a8d8049fffa8d2a473df6ba35 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 29 Jan 2025 16:47:46 -0500 Subject: [PATCH 47/51] startsWith(PO) and removed PO-E case Signed-off-by: jace-roell --- packages/zosfiles/src/methods/copy/Copy.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/zosfiles/src/methods/copy/Copy.ts b/packages/zosfiles/src/methods/copy/Copy.ts index cb7b56ef5e..7e5d91d90e 100644 --- a/packages/zosfiles/src/methods/copy/Copy.ts +++ b/packages/zosfiles/src/methods/copy/Copy.ts @@ -272,7 +272,7 @@ export class Copy { /* * If the source is a PDS and no member was specified then abort the copy. */ - if((sourceDataSetObj.dsorg.startsWith("PO") || sourceDataSetObj.dsorg.startsWith("PO-E")) && sourceMember == undefined){ + if(sourceDataSetObj.dsorg.startsWith("PO") && sourceMember == undefined){ throw new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAbortedNoPDS.message }); } } @@ -316,7 +316,7 @@ export class Copy { targetDataSetObj = TargetDsList.apiResponse.items[dsnameIndex]; targetFound = true; - if((targetDataSetObj.dsorg == "PO" || targetDataSetObj.dsorg == "PO-E") && targetMember == undefined) + if(targetDataSetObj.dsorg.startsWith("PO") && targetMember == undefined) { throw new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAbortedTargetNotPDSMember.message }); } @@ -346,11 +346,11 @@ export class Copy { * If this is a PDS but the target is the sequential dataset and does not exist, * create a new sequential dataset with the same parameters as the original PDS. */ - if((createOptions.dsorg == "PO" || createOptions.dsorg == "PO-E") && targetMember == undefined){ + if(createOptions.dsorg.startsWith("PO") && targetMember == undefined){ createOptions.dsorg ="PS"; createOptions.dirblk = 0; } - else if(targetMember != undefined && (createOptions.dsorg != "PO" && createOptions.dsorg != "PO-E")) + else if(targetMember != undefined && !createOptions.dsorg.startsWith("PO")) { createOptions.dsorg ="PO"; createOptions.dirblk = 1; @@ -419,7 +419,7 @@ export class Copy { storclass: targetOptions.targetStorageClass, mgntclass: targetOptions.targetManagementClass, dataclass: targetOptions.targetDataClass, - dirblk: parseInt(dsInfo.dsorg == "PO" || dsInfo.dsorg == "PO-E" ? "10" : "0") + dirblk: parseInt(dsInfo.dsorg.startsWith("PO") ? "10" : "0") })); } From 60ddb427ce1b3722ed6d9925ebd3d6de32acf01a Mon Sep 17 00:00:00 2001 From: jace-roell Date: Wed, 29 Jan 2025 16:51:19 -0500 Subject: [PATCH 48/51] example Signed-off-by: jace-roell --- .../src/zosjobs/download/download-output/Output.definition.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/cli/src/zosjobs/download/download-output/Output.definition.ts b/packages/cli/src/zosjobs/download/download-output/Output.definition.ts index 321d294407..83e59f8b12 100644 --- a/packages/cli/src/zosjobs/download/download-output/Output.definition.ts +++ b/packages/cli/src/zosjobs/download/download-output/Output.definition.ts @@ -98,6 +98,10 @@ export const OutputDefinition: ICommandDefinition = { { description: "Download all the output of the job with job ID JOB00234 to an automatically generated directory.", options: "JOB00234" + }, + { + description: "Download the records in the range of 0 to 100 from a job spool.", + options: "--record-range '0-100'" } ] }; From 6591bee130c6f1eb45fd96d470a6e7c380beea83 Mon Sep 17 00:00:00 2001 From: Pujal Date: Thu, 30 Jan 2025 08:41:47 -0500 Subject: [PATCH 49/51] integration snapshots Signed-off-by: Pujal --- .../cli.files.copy.ds.integration.test.ts.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap index c439ffd6e3..c432eb3b15 100644 --- a/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap +++ b/packages/cli/__tests__/zosfiles/__integration__/copy/ds/__snapshots__/cli.files.copy.ds.integration.test.ts.snap @@ -37,7 +37,7 @@ exports[`Copy Data Set should display the help 1`] = ` Specify this option as true if you wish to replace like-named members in the target data set - --safe-replace | --safe-rep (boolean) + --safe-replace | --safe-rep | ----sr (boolean) Specify this option as true if you wish to replace like-named members or the content of the target data set. This option will prompt to confirm. @@ -180,8 +180,8 @@ exports[`Copy Data Set should display the help in json format 1`] = ` \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: data-set.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep | ----sr (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n data-set | ds\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Copy a data set/partitioned data set to another data set/partitioned data set.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-files copy data-set [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n fromDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy from\\\\n\\\\n toDataSetName\\\\t\\\\t (string)\\\\n\\\\n The name of the data set that you want to copy to\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --replace | --rep (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members in the\\\\n target data set\\\\n\\\\n --safe-replace | --safe-rep | ----sr (boolean)\\\\n\\\\n Specify this option as true if you wish to replace like-named members or the\\\\n content of the target data set. This option will prompt to confirm.\\\\n\\\\n --response-timeout | --rto (number)\\\\n\\\\n The maximum amount of time in seconds the z/OSMF Files TSO servlet should run\\\\n before returning a response. Any request exceeding this amount of time will be\\\\n terminated and return an error. Allowed values: 5 - 600\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n member named 'USER.TO.SET(MEM2)':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET(mem2)\\\\\\"\\\\n\\\\n - Copy the data set member named 'USER.FROM.SET(MEM1)' to the\\\\n data set named 'USER.TO.SET':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET(mem1)\\\\\\" \\\\\\"USER.TO.SET\\\\\\"\\\\n\\\\n - Copy the data set named 'USER.FROM.SET' to the data set\\\\n named 'USER.TO.SET' and replace like-named members:\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --replace\\\\n\\\\n - Copy the partitioned data set named 'TEST.PDS1' to the\\\\n partitioned data set named 'TEST.PDS2':\\\\n\\\\n $ zowe zos-files copy data-set \\\\\\"USER.FROM.SET\\\\\\" \\\\\\"USER.TO.SET\\\\\\" --safe-replace\\\\n\\\\n\\" }" `; From bc7ae7a8cbf3ddaf102d21043db96abc22beeef9 Mon Sep 17 00:00:00 2001 From: jace-roell Date: Thu, 30 Jan 2025 09:02:49 -0500 Subject: [PATCH 50/51] snapshots Signed-off-by: jace-roell --- .../__snapshots__/Output.definition.unit.test.ts.snap | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap b/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap index 8e7098cd83..3eedcb8f07 100644 --- a/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__unit__/download/download-output/__snapshots__/Output.definition.unit.test.ts.snap @@ -11,6 +11,10 @@ Object { "description": "Download all the output of the job with job ID JOB00234 to an automatically generated directory.", "options": "JOB00234", }, + Object { + "description": "Download the records in the range of 0 to 100 from a job spool.", + "options": "--record-range '0-100'", + }, ], "name": "output", "options": Array [ From fec675928c9988850928285300eaad3e5fdff91e Mon Sep 17 00:00:00 2001 From: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:27:06 -0500 Subject: [PATCH 51/51] chore: update integration test snapshot Signed-off-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com> --- ...cli.zos-jobs.download.output.integration.test.ts.snap | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap b/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap index 6bde84c822..41ee20981f 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__integration__/download/__snapshots__/cli.zos-jobs.download.output.integration.test.ts.snap @@ -203,12 +203,17 @@ exports[`zos-jobs download output command should display the help 1`] = ` $ zowe zos-jobs download output JOB00234 + - Download the records in the range of 0 to 100 from a job + spool.: + + $ zowe zos-jobs download output --record-range '0-100' + { \\"success\\": true, \\"exitCode\\": 0, \\"message\\": \\"The help was constructed for command: output.\\", - \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n Zero indexed range of records to download from a spool file. (example: 0-100)\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\", + \\"stdout\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n Zero indexed range of records to download from a spool file. (example: 0-100)\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n - Download the records in the range of 0 to 100 from a job\\\\n spool.:\\\\n\\\\n $ zowe zos-jobs download output --record-range '0-100'\\\\n\\\\n\\", \\"stderr\\": \\"\\", - \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n Zero indexed range of records to download from a spool file. (example: 0-100)\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n\\" + \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n output | o\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Download all job output to a local directory. Each spool DD will be downloaded\\\\n to its own file in the directory.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-jobs download output [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n jobid\\\\t\\\\t (string)\\\\n\\\\n The z/OS JOBID of the job containing the spool files you want to view. No\\\\n pre-validation of the JOBID is performed.\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --directory | -d | --dir (string)\\\\n\\\\n The local directory you would like to download the output for the job to.\\\\n\\\\n --extension | -e (string)\\\\n\\\\n A file extension to save the job output with. Defaults to '.txt'.\\\\n\\\\n --omit-jobid-directory | --ojd (boolean)\\\\n\\\\n If specified, job output will be saved directly to the specified directory\\\\n rather than creating a subdirectory named after the ID of the job.\\\\n\\\\n --binary | -b (boolean)\\\\n\\\\n If specified, job output will be downloaded in binary format instead of\\\\n performing text conversion. Conflicts with record.\\\\n\\\\n --record | -r (boolean)\\\\n\\\\n If specified, job output will be downloaded in record format instead of\\\\n performing text conversion. Conflicts with binary.\\\\n\\\\n --encoding | --ec (string)\\\\n\\\\n Download the spool file content with encoding mode, which means that data\\\\n conversion is performed using the file encoding specified.\\\\n\\\\n --wait-for-active | --wfa (boolean)\\\\n\\\\n Wait for the job to enter ACTIVE status before completing the command.\\\\n\\\\n --wait-for-output | --wfo (boolean)\\\\n\\\\n Wait for the job to enter OUTPUT status before completing the command.\\\\n\\\\n --record-range | --rr (string)\\\\n\\\\n Zero indexed range of records to download from a spool file. (example: 0-100)\\\\n\\\\n ZOSMF CONNECTION OPTIONS\\\\n ------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OSMF server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OSMF server port.\\\\n\\\\n Default value: 443\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe (z/OSMF) user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe (z/OSMF) password, which can be the same as your TSO password.\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --base-path | --bp (string)\\\\n\\\\n The base path for your API mediation layer instance. Specify this option to\\\\n prepend the base path to all z/OSMF resources when making REST requests. Do not\\\\n specify this option if you are not using an API mediation layer.\\\\n\\\\n --protocol (string)\\\\n\\\\n The protocol used (HTTP or HTTPS)\\\\n\\\\n Default value: https\\\\n Allowed values: http, https\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --zosmf-profile | --zosmf-p (string)\\\\n\\\\n The name of a (zosmf) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Download all the output of the job with job ID JOB00234 to\\\\n an automatically generated directory.:\\\\n\\\\n $ zowe zos-jobs download output JOB00234\\\\n\\\\n - Download the records in the range of 0 to 100 from a job\\\\n spool.:\\\\n\\\\n $ zowe zos-jobs download output --record-range '0-100'\\\\n\\\\n\\" }" `;