Microsoft KB Archive/67185

CALL X“AF” Enables Case Conversion in ACCEPT in COBOL 4.0

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

4.00 | 4.00 MS-DOS | OS/2

Summary: CALL X“AF” can be used to enable data case conversion in Microsoft COBOL Compiler version 4.0 for MS-DOS and MS OS/2. Upon execution of an ACCEPT statement, it can force lowercase ASCII characters to be converted automatically to uppercase. When enabled, this feature affects all input fields.

More Information: Documentation regarding the Enable/Disable Input Data Case Conversion can be found on pages 26-8 of the “Microsoft COBOL 4.0: Operating Guide.” The parameters required are defined on pages 26-3. If only selected fields need case conversion, you may prefer to use the system library routine CBL_TOUPPER as documented on pages 7-12 in the “Microsoft COBOL 4.0: Operating Guide.”

Code Example
The following sample program forces all fields entered on the screen to be converted to uppercase:

IDENTIFICATION DIVISION. PROGRAM-ID. UPPRCASE. DATA DIVISION. WORKING-STORAGE SECTION. 01 SET-BIT-PAIRS             PIC 9(2) COMP-X VALUE 1. 01 PARAMETER-BLOCK. 05 BIT-PAIR-SETTING      PIC 9(2) COMP-X. 05 FILLER                PIC X    VALUE &quot;2&quot;. 05 BIT-PAIR-NUMBER       PIC 9(2) COMP-X. 05 FILLER                PIC 9(2) COMP-X  VALUE 1. 01 TEST-DATA                 PIC X(20) VALUE SPACES. 01 JUNK                      PIC X.    SCREEN SECTION. 01 TEST-SCREEN. 05 BLANK SCREEN. 05 LINE 2 COLUMN 5 VALUE &quot;ENTER SAMPLE DATA IN LOWER CASE&quot;. 05 LINE 3 COLUMN 5 PIC X(20) JUSTIFIED TO TEST-DATA. PROCEDURE DIVISION. MOVE 85 TO BIT-PAIR-NUMBER. MOVE 1 TO BIT-PAIR-SETTING. CALL X&quot;AF&quot; USING SET-BIT-PAIRS PARAMETER-BLOCK. DISPLAY TEST-SCREEN. ACCEPT TEST-SCREEN. DISPLAY &quot;DATA ITEM RECEIVED IN PROGRAM = &quot; AT 0405. DISPLAY TEST-DATA AT 0505. STOP RUN. Additional reference words: 4.00 Copyright Microsoft Corporation 1993.