Skip to content

Commit

Permalink
Merge pull request #2038 from zowe/remove-recfm-checks
Browse files Browse the repository at this point in the history
Remove RECFM checks and add version output
  • Loading branch information
traeok authored Feb 7, 2024
2 parents 2fd6396 + 2055048 commit ece1d10
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 47 deletions.
5 changes: 5 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to the Zowe CLI package will be documented in this file.

## Recent Changes

- LTS Breaking: Removed record format (recfm) validation when issuing `zowe files create` commands [#1699](https://github.com/zowe/zowe-cli/issues/1699)
- LTS Breaking: Added Zowe release version output for `--version` [#2028](https://github.com/zowe/zowe-cli/issues/2028)

## `8.0.0-next.202402021649`

LTS Breaking: Removed the following previously deprecated items: [#1981](https://github.com/zowe/zowe-cli/pull/1981)
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@zowe/cli",
"version": "8.0.0-next.202402021649",
"zoweVersion": "V3",
"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",
Expand Down
4 changes: 4 additions & 0 deletions packages/imperative/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Imperative package will be documented in this file.

## Recent Changes

- LTS Breaking: Added Zowe release version output for `--version` [#2028](https://github.com/zowe/zowe-cli/issues/2028)

## `8.0.0-next.202401191954`

- LTS Breaking: Removed the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ exports[`cmd-cli should display the help 1`] = `
exports[`cmd-cli should display the version 1`] = `
"================ISSUING VERSION===============
0.0.0
CLI Version: 0.0.0
Zowe Release Version: V99
"
`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "cmd-sample-cli",
"version": "0.0.0",
"zoweVersion": "V99",
"description": "Command Sample CLI",
"license": "EPL-2.0",
"repository": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ exports[`Hello World should print help if the option is specified 1`] = `
`;
exports[`Hello World should print version if the option is specified 1`] = `
"0.0.0
"CLI Version: 0.0.0
Zowe Release Version: V99
"
`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "hello-world-cli",
"version": "0.0.0",
"zoweVersion": "V99",
"description": "Hello World Sample CLI",
"license": "EPL 2.0",
"repository": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "imperative-test-cli",
"version": "0.0.0",
"zoweVersion": "V99",
"description": "Imperative Test CLI",
"license": "EPL 2.0",
"repository": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe("Imperative", () => {
expect(result).toBeUndefined();
expect(mocks.Config.load).toHaveBeenCalledTimes(1);
expect(mocks.OverridesLoader.load).toHaveBeenCalledTimes(1);
expect(mocks.OverridesLoader.load).toHaveBeenCalledWith(defaultConfig, { version: 10000, name: "sample" });
expect(mocks.OverridesLoader.load).toHaveBeenCalledWith(defaultConfig, { version: 10000, name: "sample", zoweVersion: "V99" });
});

describe("AppSettings", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,22 +280,62 @@ exports[`Default Root Command Handler should display the version if --version is
Object {
"data": Object {
"version": 10000,
"zoweVersion": "V99",
},
"error": undefined,
"exitCode": 0,
"message": "Version displayed",
"message": "Version(s) displayed",
"stderr": Object {
"data": Array [],
"type": "Buffer",
},
"stdout": Object {
"data": Array [
67,
76,
73,
32,
86,
101,
114,
115,
105,
111,
110,
58,
32,
49,
48,
48,
48,
48,
10,
90,
111,
119,
101,
32,
82,
101,
108,
101,
97,
115,
101,
32,
86,
101,
114,
115,
105,
111,
110,
58,
32,
86,
57,
57,
10,
],
"type": "Buffer",
},
Expand Down
1 change: 1 addition & 0 deletions packages/imperative/src/imperative/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export * from "./src/doc/IImperativeEnvironmentalVariableSetting";
export * from "./src/doc/IImperativeEnvironmentalVariableSettings";
export * from "./src/doc/IImperativeConfig";
export * from "./src/doc/IImperativeLoggingConfig";
export * from "./src/doc/IImperativeVersions";
export * from "./src/ConfigurationLoader";
export * from "./src/ConfigurationValidator";
export * from "./src/DefinitionTreeResolver";
Expand Down
25 changes: 25 additions & 0 deletions packages/imperative/src/imperative/src/doc/IImperativeVersions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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.
*
*/

export interface IImperativeVersions {
/**
* The version of the consuming program, retrieved from `version` in package.json
* @type {string}
* @memberof IImperativeVersions
*/
version: string,
/**
* The Zowe LTS release number from the consuming program, retrieved from `zoweVersion` in package.json
* @type {string}
* @memberof IImperativeVersions
*/
zoweVersion?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Imperative } from "../../../imperative/src/Imperative";
import { ICommandHandler, IHandlerParameters, ICommandTreeEntry, CommandUtils } from "../../../cmd";
import { ImperativeConfig, TextUtils } from "../../../utilities";
import { WebHelpManager } from "../../../cmd/src/help/WebHelpManager";
import { IImperativeVersions } from "../doc/IImperativeVersions";
/**
* The default command handler for the top level/root command
* Allows the user to check the version of the package.
Expand All @@ -24,9 +25,14 @@ export default class DefaultRootCommandHandler implements ICommandHandler {
if (params.arguments.version) {
// load the user's package.json to check the version of their package
const packageJson: any = ImperativeConfig.instance.callerPackageJson;
params.response.console.log(packageJson.version);
params.response.data.setObj({ version: packageJson.version });
params.response.data.setMessage("Version displayed");
const jsonResponse: IImperativeVersions = { version: packageJson.version };
params.response.console.log("CLI Version: " + packageJson.version);
if (packageJson.zoweVersion) {
params.response.console.log("Zowe Release Version: " + packageJson.zoweVersion);
jsonResponse.zoweVersion = packageJson.zoweVersion;
}
params.response.data.setObj(jsonResponse);
params.response.data.setMessage("Version(s) displayed");
} else if(params.arguments.availableCommands) {

// Gather and display the full set of commands available to the CLI with descriptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ImperativeConfig {
}

public get callerPackageJson(): any {
return {version: 10000, name: "sample"};
return {version: 10000, zoweVersion: "V99", name: "sample"};
}

public get cliHome(): string {
Expand Down
4 changes: 4 additions & 0 deletions packages/zosfiles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the Zowe z/OS files SDK package will be documented in this file.

## Recent Changes

- LTS Breaking: Removed record format (recfm) validation when creating data-sets [#1699](https://github.com/zowe/zowe-cli/issues/1699)

## `8.0.0-next.202402021649`

- LTS Breaking: Removed the following previously deprecated items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1066,14 +1066,14 @@ describe("Create data set Validator", () => {
expect(testOptions.secondary).toEqual(0); // Should be changed during create validation to zOSMF default of 0
});

it("recfm should default to 'F' if not specified", async () => {
it("recfm should not default to anything if not specified", async () => {
const testOptions: any = {
recfm: undefined
};

Create.dataSetValidateOptions(testOptions);

expect(testOptions.recfm).toEqual("F"); // Should be changed during create validation to zOSMF default of 'F'
expect(testOptions.recfm).not.toEqual("F"); // Should not be changed during create validation to zOSMF default of 'F'
});
});

Expand Down
41 changes: 4 additions & 37 deletions packages/zosfiles/src/methods/create/Create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,10 @@ export class Create {
tempOptions.blksize = tempOptions.lrecl;
}

if(tempOptions.blksize <= tempOptions.lrecl ){
if(tempOptions.blksize <= tempOptions.lrecl ){
tempOptions.blksize = tempOptions.lrecl;
if(tempOptions.recfm === null || tempOptions.recfm === undefined){
tempOptions.recfm = "FB";
}
switch (tempOptions.recfm.toUpperCase()) {
case "V":
case "VB":
case "VBS":
case "VS":
tempOptions.blksize += 4;
break;
default:
break;
if (tempOptions.recfm && tempOptions.recfm.toUpperCase().startsWith("V")) {
tempOptions.blksize += 4;
}
}
break;
Expand Down Expand Up @@ -315,31 +305,8 @@ export class Create {
break;

case "recfm":
// zOSMF defaults to F if missing so mimic it's behavior
if (tempOptions.recfm === null || tempOptions.recfm === undefined) {
tempOptions.recfm = "F";
}
// no validation

// F, V, or U are required; B, A, M, S, T or additional
// VBA works on mainframe but not via zOSMF
switch (tempOptions.recfm.toUpperCase()) {
case "D":
case "DB":
case "DBS":
case "DS":
case "F":
case "FB":
case "FBS":
case "FS":
case "V":
case "VB":
case "VBS":
case "VS":
case "U":
break;
default:
throw new ImperativeError({ msg: ZosFilesMessages.invalidRecfmOption.message + tempOptions.recfm });
}
break;

// SMS class values
Expand Down

0 comments on commit ece1d10

Please sign in to comment.