Skip to main content

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

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

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.            


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

Got it working thanks


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

Got it working thanks


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

Got it working thanks