Microsoft KB Archive/37338

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:21, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q37338 to Microsoft KB Archive/37338 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

An Underscore in the Program-ID Causes COBOL Compiler to Hang

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

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

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, versions 3.0 and 3.0a

Summary: If the name specified in the PROGRAM-ID begins with an underscore and is not surrounded by double quotation marks, the compiler issues two error messages and then hangs, requiring a CTRL+BREAK to abort. The two error messages are as follows: 4-S “Illegal character” 14-E “Period missing. Period assumed.” Microsoft has confirmed this to be a problem in Microsoft COBOL Compiler versions 3.0 and 3.0a. This problem was corrected in Microsoft COBOL Professional Development System version 4.0 for MS-DOS and MS OS/2. To work around the problem, put the program name in the PROGRAM-ID inside double-quotation marks.

More Information: For interlanguage calling with C, if C calls a COBOL 3.0 or 3.0a routine, you must use an underscore in the PROGRAM-ID in order to force an underscore into the name in the .OBJ file. Note that the underscore character in the PROGRAM-ID is not allowed in Microsoft COBOL Compiler versions 2.0, 2.1, 2.2, and earlier. To reproduce the problem, compile the sample program below with the following command line and accept the standard default directives: COBOL progname;

Code Example

   IDENTIFICATION DIVISION.
   PROGRAM-ID. _cobsub.
  * To work around the problem, use: PROGRAM-ID. "_cobsub".
   ENVIRONMENT DIVISION.
   DATA DIVISION.
   LINKAGE SECTION.
   01  DUMMY            PIC 9(4) COMP-5.
   PROCEDURE DIVISION USING DUMMY.
       DISPLAY DUMMY.
       DISPLAY " GREETINGS FROM THE COBOL SUBROUTINE ".
       EXIT PROGRAM.

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