A fix is available
APAR status
Closed as program error.
Error description
Given this code for an AMODE64 program: WORKING-STORAGE SECTION. 01 TEST-DATA. 02 NUM-DISP PIC S9(4). PROCEDURE DIVISION. BEGIN. MOVE 0 To TALLY MOVE SPACES TO TEST-DATA INSPECT NUM-DISP TALLYING TALLY FOR ALL '0' IF TALLY > 0 THEN DISPLAY 'This is COBOL V4 or earlier' ELSE DISPLAY 'This is COBOL V6+' END-IF DISPLAY 'TALLY = <' TALLY '>'. DISPLAY 'TEST DATA = <' TEST-DATA '>'. GOBACK. Chapter 17 of the COBOL V5+ Migration Guide documents that "COBOL V5 and later versions will not unexpectedly modify the inspected data item." However, the COBOL Runtime has an error in internal logic such that when the inspected item is a signed zoned-decimal data item, such as NUM-DISP PIC S9(9), then TALLY in the above example will not equal zero as it should. When spaces are moved to TEST-DATA, its value is x'404040404040404040'. The runtime error causes the sign nibble to become x'4040404040404040F0', which causes the INSPECT to find 1 zero. If the inspected item is unsigned (without 'S'), the error does not happen.
Local fix
Add a NUMERIC class test before the INSPECT, avoid moving spaces or alphanumeric data into the inspected item, or move zeroes into the inspected item.
Problem summary
**************************************************************** * USERS AFFECTED: Users of Enterprise COBOL 6.3 and later * * releases running AMODE 64 programs which * * use the INSPECT ... TALLYING statement. * **************************************************************** * PROBLEM DESCRIPTION: The INSPECT ... TALLYING statement * * incorrectly counts the occurrence of * * a specific character. * **************************************************************** * RECOMMENDATION: Install the provided PTF. * **************************************************************** When an item to be inspected is signed numeric display (zoned-decimal) that is initialized with a non-numerical value such as spaces, COBOL Runtime inadvertently processes the sign nibbles of the item as if it contains x'F'. For example, ... WORKING-STORAGE SECTION. 01 TALLY-IT PIC 9 VALUE 0. 01 TEST-DATA. 02 NUM-DISP PIC S9(9). ... PROCEDURE DIVISION. MOVE SPACES TO TEST-DATA. INSPECT NUM-DISP TALLYING TALLY-IT FOR ALL '0'. DISPLAY 'TALLY-IT = ' TALLY-IT. GOBACK. This program outputs: TALLY-IT = 1 COB0603T/K
Problem conclusion
The INSPECT processing in the COBOL Runtime has been corrected. With the correction, the above example outputs: TALLY-IT = 0 For more details, refer to the 'INSPECT...TALLYING behavior' in 'Enterprise COBOL for z/OS Migration guide'. Below is quoted from the Migration Guide: "INSPECT...TALLYING behavior ... For INSPECT...TALLYING, previous versions of the compiler insert zone nibbles in a signed numeric display inspected item before performing the INSPECT. This will, for example, change SPACES to ZEROS. COBOL V5 and later versions no longer do this zone normalization."
Temporary fix
Comments
APAR Information
APAR number
PH29138
Reported component name
LE ENT COBOL LI
Reported component ID
568819812
Reported release
7C0
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2020-09-03
Closed date
2020-09-15
Last modified date
2020-10-02
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Modules/Macros
CELQSG04 CELQV004 IGZQAPI IGZQCDA IGZQINPL
Fix information
Fixed component name
LE ENT COBOL LI
Fixed component ID
568819812
Applicable component levels
Fix is available
Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.
[{"Line of Business":{"code":"LOB17","label":"Mainframe TPS"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SS6SG3","label":"Enterprise COBOL for z\/OS"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7C0"}]
Document Information
Modified date:
05 October 2020