Question & Answer
Question
What code is flagged by IBM Developer for z/OS (IDz) when the "Declare a single variable in an IF, WHILE, UNTIL or WHEN clause as BIT(1) NONVARYING." rule is set?
Cause
If analyzing code in IDz with the rule set for PLI > Performance > Declare a single variable in an IF, WHILE, UNTIL or WHEN clause as BIT(1) NONVARYING, then IDz will locate all IF, WHILE, UNTIL, and WHEN clauses.
If a clause consists of a single variable, the declaration of the variable is examined.
If the declaration is not BIT(1) NONVARYING, the clause is flagged as a rule violation.
If a clause consists of a single variable, the declaration of the variable is examined.
If the declaration is not BIT(1) NONVARYING, the clause is flagged as a rule violation.
Answer
In the sample code, the first IF statement will NOT be flagged with the rule set for Declare a single variable in an IF, WHILE, UNTIL or WHEN clause as BIT(1) NONVARYING.
Below is a picture showing the IDz client with the statements flagged after running the Software Analyzer with the one rule checked.

The IF test.a = 'B' statement will not be flagged either.
|
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
|---|
DCL 1 test,
7 a char(2),
7 b char(2);
DCL D BIT BIN ;
DCL C BIT(1) NONVARYING;
IF C then test.a = 'A';
IF D then test.a = 'B';
IF test.a then test.a = 'B';
IF test.a = 'B' then test.a = 'C';
IF D then test.a = 'C';
SELECT ;
WHEN( test.a )
OTHERWISE
test.a = 'c';
END ;
END check_value; Below is a picture showing the IDz client with the statements flagged after running the Software Analyzer with the one rule checked.

[{"Type":"MASTER","Line of Business":{"code":"LOB35","label":"Mainframe SW"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSTRMM","label":"IBM Developer for z\/OS"},"ARM Category":[{"code":"a8m0z00000009KjAAI","label":"IBM Developer for Z\/OS-\u003ECode Review\\Software Analyzer"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]
Product Synonym
IDz
Was this topic helpful?
Document Information
Modified date:
22 November 2023
UID
swg21685983