Highlighted
Trusted Contributor.
Trusted Contributor.
147 views

Code Analysis Uninitialized Data Items

I'm hoping to apply the "Uninitialized Data Items" rule from the Code Analysis menu, but I can't seem to make it work.  What might be wrong?

I am using:

COBOL for Eclipse 

Version: 5.0.297.v202001281613

For example, the contents of the copybook below are flagged as uninitialized despite the Procedure Division code containing this statement.

 

 

010700*****************************************************************
010800* Initialize our output area                                    *
010900*****************************************************************
011000     Initialize CD51O-DATA.
 05  CD51-DATA.                                                 cbankd51
001500     10  CD51I-DATA.                                              cbankd51
001600       15  CD51I-PID                         PIC X(5).            cbankd51
001700         88  CD51-REQUESTED-ALL              VALUE 'ALL  '.       cbankd51
001800     10  CD51O-DATA.                                              cbankd51
001900       15  CD51O-PID                         PIC X(5).            cbankd51
002000       15  CD51O-NAME                        PIC X(25).           cbankd51
002100       15  CD51O-ADDR1                       PIC X(25).           cbankd51
002200       15  CD51O-ADDR2                       PIC X(25).           cbankd51
002300       15  CD51O-STATE                       PIC X(2).            cbankd51
002400       15  CD51O-CNTRY                       PIC X(6).            cbankd51
002500       15  CD51O-POST-CODE                   PIC X(6).            cbankd51
002600       15  CD51O-EMAIL                       PIC X(30).           cbankd51
002700       15  CD51O-ACC-NO                      PIC X(9).            cbankd51
002800       15  CD51O-ACC-DESC                    PIC X(15).           cbankd51
002900       15  CD51O-ACC-CURR-BAL                PIC S9(7)V99 COMP-3. cbankd51
003000       15  CD51O-ACC-LAST-STMT-DTE           PIC X(10).           cbankd51
003100       15  CD51O-ACC-LAST-STMT-BAL           PIC S9(7)V99 COMP-3. cbankd51

 

 

 Here's the output from the analysis:

 

 

Uninitialized Data Items - General Queries (24 matches)
DBANK51P.cbl - \Samples (24 matches)
WS-SUB1
WS-BNKACC-STAT1
WS-BNKACC-STAT2
WS-BNKCUST-STAT1
WS-BNKCUST-STAT2
WS-BNKATYP-STAT1
WS-BNKATYP-STAT2
IO-REQUEST-FUNCTION
IO-REQUEST-STATUS
CD51I-PID
CD51O-PID
CD51O-NAME
CD51O-ADDR1
CD51O-ADDR2
CD51O-STATE
CD51O-CNTRY
CD51O-POST-CODE
CD51O-EMAIL
CD51O-ACC-NO
CD51O-ACC-DESC
CD51O-ACC-CURR-BAL
CD51O-ACC-LAST-STMT-DTE
CD51O-ACC-LAST-STMT-BAL
LK-COMMAREA

 

 

 

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Code Analysis Uninitialized Data Items

The uninitialized data items report seems to only report those elementary level data items that do not contain a VALUE clause.

It does not take into consideration the INITIALIZE statement.

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Code Analysis Uninitialized Data Items

Thanks for the response Chris. As is, the report doesn't seem too useful in the real world. My experience is that INITIALIZE or MOVE statements are the usual means by which working storage is placed in a reliable initial state. Are there any other options available for completing this check?
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.