Microsoft KB Archive/34915
How to Display Graphics Characters in COBOL 2.x with ANSI.SYS
PSS ID Number: Q34915 Article last modified on 04-21-1993
2.00 2.10 2.20 MS-DOS
|The information in this article applies to:|
|- Microsoft COBOL for MS-DOS, versions 2.0, 2.1, and 2.2|
Summary: The following program demonstrates how graphics characters can be displayed to the screen in COBOL Versions 2.0, 2.1, and 2.2 if RUNCOB.EXE is INSTALLed for the MS-DOS ANSI device driver. The program will not display graphics characters if RUNCOB.EXE is INSTALLed with the IBM PC option. The ASCII value of the graphics characters can be typed into one byte in a quoted VALUE in a PIC X field in some text editors by holding down the ALT key and pressing three digits from the numeric keypad. For example, when editing the COBOL program in Microsoft Word Version 4.0 or 5.0, hold down the ALT key, press 002 on the numeric keypad (with NUM LOCK active), and release the ALT key. This inserts an inverse-video smiling-face character (an ASCII 2) into your source file.
More Information: ASCII byte values of 1 through 31 are often referred to as control characters, most of which are associated with a certain graphics character on MS-DOS computers. For example, an ASCII value of 003 is a heart, 004 is a diamond, 005 is a club, and 006 is a spade. Extended-ASCII characters (byte values of 128 through 255) are also associated with graphics characters, such as line-drawing graphics and foreign-alphabet letters. For documentation of the graphics characters associated with ASCII bytes 1-31 and 128-255, please see Pages 464-465 (Appendix A) of the “Microsoft QuickBASIC 4.0: Language Reference” manual, or see the IBM BASICA manual. Note that some text editors may not allow you to enter certain control codes or extended ASCII characters into your file using the ALT key, since certain codes may be reserved for special use in that editor, or the ALT key may be remapped for other usage. These editors may offer a different technique for entering control characters (see your editor’s manual). Note that ASCII bytes 1-31 and 128-255 may or may not be visible in your editor, even though the correct byte value is actually stored in the file. For example, ASCII 14 looks like a musical note when displayed in DOS, but appears as a line of dots in Microsoft Word Version 5.0.
For the following program to work, run COBOL’s INSTALL.EXE to configure RUNCOB.EXE for the MS-DOS ANSI.SYS terminal driver. The DOS ANSI.SYS driver must be installed at boot time with a DEVICE=ANSI.SYS statement in the CONFIG.SYS text file on the root directory of your DOS disk. IDENTIFICATION DIVISION. PROGRAM-ID. AUG25. * How to display graphics characters on the screen: SECURITY. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. * In many text editors, you can hold down the ALT key and * press three numeric keypad digits to insert a desired * character into the quoted string below; other editors * may have other techniques to type control characters: 01 IIX PIC X(30) VALUE ’ [Press ALT+0+0+2 here] ’. 01 NULLX PIC X(1). SCREEN SECTION. 01 BLANK-SCREEN. 03 BLANK SCREEN. 01 TUTOR-SCREEN. 03 BLANK SCREEN. 03 LINE 5 COLUMN 1 PIC X(30) USING IIX. PROCEDURE DIVISION. ONLY-PROC. ACCEPT TUTOR-SCREEN. DISPLAY IIX. ACCEPT NULLX. STOP RUN.
Additional reference words: 2.00 2.10 2.20 Copyright Microsoft Corporation 1993.