Skip to Main Content
IBM Z Software


This portal is to open public enhancement requests against IBM Z Software products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Future consideration
Workspace COBOL Compilers
Created by Guest
Created on Jan 3, 2020

Enhance INITCHECK so it catches the use of uninitialized indexes in SEARCH statements

The frequent programming error of forgetting to set an index before a SEARCH is not being detected by INITCHECK. In the following example program, the index U150-ACT-IND-IDX is erroneously not set before the SEARCH U150-TRANX-ACT-IND-DATA line. With the INITCHECK compiler option in effect, it is not detecting this programming error where the U150-ACT-IND-IDX index is used before it is set.

PROGRAM-ID. TESTPROG.
DATA DIVISION.
LOCAL-STORAGE SECTION.
01 GROUP-A.
10 U150-TRANX-ACT-IND-DATA
OCCURS 16 TIMES INDEXED BY U150-ACT-IND-IDX.
15 U150-ACT-IND PIC X VALUE 'A'.
PROCEDURE DIVISION.
AA000-MAINLINE SECTION.
SEARCH U150-TRANX-ACT-IND-DATA
WHEN U150-ACT-IND(U150-ACT-IND-IDX) = 'A'
CONTINUE
END-SEARCH.
GOBACK.
END PROGRAM TESTPROG.

INITCHECK currently doesn't catch the index being used before it is set because it considers there is a reference to the index that could possibly initialize it. Specifically, in the SEARCH statement, it generates a loop:

1) Read U150-ACT-IND-IDX

2) Check the current position in U150-ACT-IND - the WHEN clause (reads U150-ACT-IND-IDX)

3) Increment U150-ACT-IND-IDX

4) Jump to top of loop

In the above loop, since U150-ACT-IND-IDX is initialized in step 3, it is also initialized in step 4. And since step 4 can loop back to step 1, it cannot assume that it is uninitialized at any time it gets to step 1.

-------------------------------
A suggestion - perhaps the compiler could consider the step "1) We read U150-ACT-IND-IDX" as two separate steps 1a and 1b i.e. 1a being the first iteration of the loop and 1b being the target of the step "4) Jump to top of loop". Then INITCHECK could detect the recurring programming error of forgetting to set an index before a SEARCH, because the index would not be set before step 1a. It would only be set before step 1b.

Idea priority Medium
  • Guest
    Reply
    |
    Feb 5, 2020

    This RFE is being accepted and will be updated once put into plan.