Microsoft KB Archive/40858

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:22, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q40858 to Microsoft KB Archive/40858 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 ACCEPT identifier FROM DAY-OF-WEEK, Sunday to Saturday

PSS ID Number: Q40858 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: Microsoft COBOL Versions 3.0 and 3.0a follow the ANSII 85 standard, which includes DAY-OF-WEEK. The reserved word DAY-OF-WEEK is a special register that contains the day of the week as a number. The number varies from 0 for Sunday to 6 for Saturday. DAY-OF-WEEK is not available in versions of Microsoft COBOL earlier than Version 3.0. DAY-OF-WEEK needs to be added to the list of conceptual data items (such as DATE, DAY, TIME) listed for the Format 2 ACCEPT statement on Page 3-86 of the “Microsoft COBOL Version 3.0: Language Reference Manual,” as follows: ACCEPT identifier FROM DAY-OF-WEEK

More Information: The program example shown below, which gives an example of using DAY-OF-WEEK, can be compiled with no COBOL.DIR and no special linking. The compile step: COBOL prognam.cbl; The LINK step: LINK Prognam.obj; The following is the example code: $SET ANS85 WORKING-STORAGE SECTION. 01 TheDay PIC 9. 01 DAY-LIST. 05 PIC X(9) VALUE “SUNDAY”. 05 PIC X(9) VALUE “MONDAY”. 05 PIC X(9) VALUE “TUESDAY”. 05 PIC X(9) VALUE “WEDNESDAY”. 05 PIC X(9) VALUE “THURSDAY”. 05 PIC X(9) VALUE “FRIDAY”. 05 PIC X(9) VALUE “SATURDAY”. 01 DAY-TABLE REDEFINES DAY-LIST. 05 WEEK-DAY PIC X(9) OCCURS 7 TIMES. PROCEDURE DIVISION. ACCEPT TheDay FROM DAY-OF-WEEK. ADD 1 TO TheDay. DISPLAY “THE DAY OF THE WEEK IS”, WEEK-DAY (TheDay). STOP RUN.

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