Microsoft KB Archive/60421

SCREEN ACCEPT of PIC Z Containing “V” Fails; Use “.”

PSS ID Number: Q60421 Article last modified on 04-20-1993

3.00 3.00a 4.00 | 3.00 3.00a 4.00 MS-DOS | OS/2

Summary: SCREEN ACCEPTs of numeric-edited (PIC Z) fields containing a “V” character to denote a decimal do not accept the correct value. The decimal portion of the WORKING-STORAGE variable is filled with zeros for any input, and the whole portion (before the “V”) is set to the last digits entered in the SCREEN ACCEPT. For example, if “12345” is ACCEPTed into a PIC ZZZVZZ, the WORKING-STORAGE variable will then contain “34500”. To work around this problem, use the period (“.”) for a decimal point instead of the “V” or use a normal ACCEPT instead of a SCREEN ACCEPT. Microsoft has confirmed this to be a problem in Microsoft COBOL Compiler versions 3.0 and 3.0a for MS-DOS and MS OS/2, and in Microsoft COBOL Professional Development System version 4.0 for MS-DOS and MS OS/2. We are researching this problem and will post new information here as it becomes available.

Code Example
The following code example demonstrates how ACCEPTing PIC Z clauses containing a “V” character fails and the workaround of using a PIC Z containing a period (“.”) instead of a “V”: WORKING-STORAGE SECTION. 01 NUMEDIT-WORK PIC ZZZ.ZZ. 01 NUMEDIT-FAIL PIC ZZZVZZ. SCREEN SECTION. 01 PICZ-SCREEN. 05 BLANK SCREEN. 05 LINE 1 COLUMN 1 PIC ZZZ.ZZ TO NUMEDIT-WORK. ''PIC clauses using V character does not work correctly. 05 LINE 2 COLUMN 1 PIC ZZZVZZ TO NUMEDIT-FAIL. PROCEDURE DIVISION. MAIN. DISPLAY PICZ-SCREEN. ACCEPT PICZ-SCREEN. ''First format works correctly. DISPLAY NUMEDIT-WORK. ''Second format only takes last 3 digits and 0’s decimal. DISPLAY NUMEDIT-FAIL. ''Normal ACCEPT works correctly. ACCEPT NUMEDIT-FAIL. DISPLAY NUMEDIT-FAIL. STOP RUN. If 12345 is entered into each of the ACCEPTed fields in the above program, the DISPLAYed output is as follows: 123.45 34500 12345 The ACCEPT using a period (“.”) accepted the correct information, but the ACCEPT with the “V” used only the last three digits entered and zeroed the decimal portion.

Additional reference words: 3.00 3.00a 4.00 Copyright Microsoft Corporation 1993.