Highlighted
Absent Member.
Absent Member.
1331 views

Question About Zero Suppression

Jump to solution

I have been testing Visual Cobol against an older Cobol main frame system and just have a question about Z Zero Suppression

Here's a sample program

IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE.

ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

DATA DIVISION.



WORKING-STORAGE SECTION.


01 TEST-RECORD.
05 PR-NUM PIC 99v99.
05 PR-NUM1 PIC ZZ.99.

PROCEDURE DIVISION.
PARA-1.

Display "Enter number"
ACCEPT PR-NUM
move PR-NUM to PR-NUM1
DISPLAY PR-NUM1

STOP RUN.

When I run the program in Micro Focus Cobol and enter in the following data 0328 I get 28.00 which is not right.

When I run the program in our older mainframe and enter in the following data 0328 I get 3.28 which is to be expected the leading zero is suppressed.

Not sure how to get Zero Suppression working in Micro Focus Cobol

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: Question About Zero Suppression

Jump to solution

With this code you have to enter 3.28, which will give you as display result : blank3.28, with other words you must use the decimal point on the keyboard.

However: if you add another line to your code, you will get the desired result and your 0328 will be displayed as 3.28 on Microfocus Cobol.

01 TEST-RECORD.

05 PR-NUM PIC 9999.

05 pr-num0 redefines pr-num pic 99v99.

05 PR-NUM1  PIC ZZ.99.

Display "Enter number"

ACCEPT PR-NUM        

move PR-NUM0 to PR-NUM1

DISPLAY PR-NUM1      

STOP RUN.            

View solution in original post

0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: Question About Zero Suppression

Jump to solution

With this code you have to enter 3.28, which will give you as display result : blank3.28, with other words you must use the decimal point on the keyboard.

However: if you add another line to your code, you will get the desired result and your 0328 will be displayed as 3.28 on Microfocus Cobol.

01 TEST-RECORD.

05 PR-NUM PIC 9999.

05 pr-num0 redefines pr-num pic 99v99.

05 PR-NUM1  PIC ZZ.99.

Display "Enter number"

ACCEPT PR-NUM        

move PR-NUM0 to PR-NUM1

DISPLAY PR-NUM1      

STOP RUN.            

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Question About Zero Suppression

Jump to solution

Got it working thanks

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.