Microsoft KB Archive/36078

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

How to Use Hexadecimal Literal Constants in COBOL 3.0

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

3.00 | 3.00 MS-DOS | OS/2

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

Summary: One excellent feature of COBOL Version 3.0 is the ability to express numbers in their hexadecimal form in a literal constant. Use an X prefix before the quotes for a hexadecimal number loaded in an alphanumeric field. Use an H prefix before the quotes for a hexadecimal number loaded in a numeric field. The following program segment demonstrates some valid forms of hexadecimal constants: DATA DIVISION. WORKING-STORAGE SECTION. 77 HEX-NUM-1 PIC X(4) VALUE X“FFEB”. 77 HEX-NUM-2 PIC 9(4) VALUE H“FFEB”. PROCEDURE DIVISION. 000-MAIN. MOVE X“ABCD” TO HEX-NUM-1. MOVE H“BBBB” TO HEX-NUM-2. STOP RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.