Microsoft KB Archive/40141

Two Formats of ACCEPT into Signed Numeric Behave Differently

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

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

Summary: In Microsoft COBOL versions 3.0 and 3.0a, the ACCEPT statement does not function the same under two different formats. When using the ACCEPT statement, different results may come from similar statement formats when using signed numeric fields. (When a sign is placed after the PICture clause, it becomes a numeric edited field.) Using the ACCEPT statement to read from a specific column and row location, the numeric information is formatted on the screen. When not specifying the location, the information is not formatted, which produces different ACCEPTed information. However, when using the DISPLAY statement to look at that information, the values are not the same as the ones displayed when entered. Microsoft has confirmed this to be a problem in versions 3.0 and 3.0a and Microsoft COBOL Professional Development System version 4.0 for MS-DOS and MS OS/2.

More Information: In the sample program below, the first set of data entered from the keyboard uses the following ACCEPT format: ACCEPT data-name AT LIN/COL. The second group of values uses the following different ACCEPT format: ACCEPT data-name. The COBOL program below may be compiled and LINKed with the default directives and no COBOL.DIR file, such as the following: COBOL progname; LINK progname; After entering the same exact data for each ACCEPT, the DISPLAYed output will be different. The following sample program demonstrates the problem: Working-Storage Section. '' 01 wrk-value1 pic 9(6)-. 01 wrk-value2 pic 9(6)+. 01 wrk-value3 pic S9(6). '' Procedure Division. '' ACCEPT wrk-value1 AT 0503. ACCEPT wrk-value2 AT 0603. ACCEPT wrk-value3 AT 0703. '' display “Test Value1 =”, wrk-value1. display “Test Value2 =”, wrk-value2. display “Test Value3 =”, wrk-value3. '' ACCEPT wrk-value1. ACCEPT wrk-value2. ACCEPT wrk-value3. '' display “Test Value1 =”, wrk-value1. display “Test Value2 =”, wrk-value2. display “Test Value3 =”, wrk-value3. Stop Run.

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