A fix is available
APAR status
Closed as program error.
Error description
Given this code: 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 V5 and later * * releases running 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 nibble 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 COB0501T/K COB0502T/K COB0601T/K COB0602T/K 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 releases no longer do this zone normalization."
Temporary fix
Comments
APAR Information
APAR number
PH28398
Reported component name
ENT COBOL FOR Z
Reported component ID
5655EC600
Reported release
7C0
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2020-08-11
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
IGZCEV4 IGZLLIBV IGZXAPI IGZXCDA IGZXD24 IGZXDMR IGZXLPIO IGZXLPKA IGZXLPKB IGZXLPKC IGZXLPKD IGZXLPKE IGZXLPKF IGZXLPKG IGZXPK2
Fix information
Fixed component name
LE ENT COBOL LI
Fixed component ID
568819812
Applicable component levels
R7A0 PSY UI71561
UP20/09/26 P F009
R7B0 PSY UI71562
UP20/09/26 P F009
R7C0 PSY UI71563
UP20/09/26 P F009
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.
[{"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","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]
Document Information
Modified date:
12 December 2023