PreviousDOS/VS COBOL Support Ryan McFarland COBOL V2.0 Syntax SupportNext"

Chapter 11: Microsoft COBOL V1.0 and V2.0 Syntax Support

The Microsoft syntax listed in this chapter is accepted by your COBOL system purely for compatibility with IBM 1.0 syntax and Microsoft V2.0 syntax. Many features found in Microsoft COBOL exist already in COBOL. These are documented in your Language Reference. Some of the compatibility syntax listed in this chapter is identical to standard COBOL syntax, but behaves differently if you set the MS Compiler directive when you submit your source code to your COBOL system. Other Microsoft syntax is available only if this directive is set. See your the IBM COBOL 1.0 manual and Microsoft COBOL V2.0 manual for further information on the Microsoft syntax. This manual covers IBM COBOL V1.0; where syntax is a Microsoft V2.0 extension it is explicitly indicated.

11.1 Special Registers LIN and COL

LIN and COL are intended to be used for specifying the line number and column number, respectively, of the current cursor position on the screen. Together they form part of the position-spec phrase which is supported in the ACCEPT, DISPLAY and EXHIBIT statements documented later in this chapter. You must set the MS Compiler directive when you submit your source code to your COBOL system if it contains these registers.

The format of both LIN and COL is PIC S9(4) COMP. They are used like ordinary data items, except that they must not be declared; they are automatically declared by the system. You must set them to the desired values before using them in the position-spec phrase.

Note that COL, the abbreviation for COLUMN, is not available as a COBOL reserved word if the MS Compiler directive is set.

11.2 Environment Division

11.2.1 The Special-Names Paragraph

The following two clauses are supported:

where: n is an integer in the range 0 to 8. The default setting is OFF.

11.3 Data Division

11.3.1 The USAGE Clause

General Format

The following format of the USAGE clause is supported:

Syntax Rules

  1. COMP and COMPUTATIONAL are synonymous.

  2. COMP-0 and COMPUTATIONAL-0 are synonymous.

General Rules

  1. USAGE IS COMPUTATIONAL means the same as USAGE IS DISPLAY, if you set the MS Compiler directive when you submit your source code to your COBOL system.

  2. USAGE IS COMP-0 is allowed only with numeric items. If an item is described with a PICTURE no larger than S9(4), the effect is a data item whose description is PIC S9(4) USAGE COMP; that is, a 2-byte signed binary item. Otherwise, the effect is a data item with the PICTURE clause actually specified and with USAGE DISPLAY.

11.4 Procedure Division

11.4.1 The Position-Specification Phrase

The position-specification phrase specifies the screen position in the ACCEPT, DISPLAY and EXHIBIT statements described in this chapter. You must set the MS Compiler directive when you submit your source code to your COBOL system if it contains this phrase.

General Format

Syntax Rules

  1. The comma shown in the above format is mandatory.

11.4.2 The ACCEPT Statement

The following format of the ACCEPT statement is supported:

General Format

General Rules

  1. The ACCEPT operation treats a group item as an elementary item, if you set the MS Compiler directive when you submit your source code to your COBOL system: it accepts the item itself and not its subordinate elementary items.

  2. If the screen position at which the first operand is to appear is not specified, the default is the current cursor position, if you set the MS Compiler directive when you submit your source code to your COBOL system.

  3. Rules 1 and 2 above also apply to Format 2 of the ACCEPT statement in the chapter Program Definition in your Language Reference.

  4. The WITH phrase options and their equivalents are:

    AUTO/AUTO-SKIP
    BACKGROUND-COLOR
    BELL/BEEP
    BLINK
    REVERSE-VIDEO
    RIGHT-JUSTIFY
    SECURE/NO-ECHO
    SIZE
    SPACE-FILL
    TRAILING-SIGN
    UNDERLINE
    UPDATE
    ZERO-FILL

    These options also apply to Format 2 of the ACCEPT statement in the chapter Program Definition in your Language Reference.

    The options listed below differ from standard COBOL, as follows:

    1. UPDATE . If the UPDATE option is not specified, a data item for data entry is displayed initially as spaces, if you set the MS Compiler directive when you submit your source code to your COBOL system. (If the MS directive is not set, the display of initial data is a configuration option.)

      If the UPDATE option is specified, initial data of the data item for data entry is displayed.

    2. PROMPT . This option need not be specified to display prompt characters, if you set the MS Compiler directive when you submit your source code to your COBOL system.

    3. LENGTH-CHECK . If this option is specified, it causes an implicit EMPTY-CHECK option, so that the operator must enter something. You set the MS Compiler directive when you submit your source code to your COBOL system, if you have specified this option.

    4. FOREGROUND-COLOR and BACKGROUND-COLOR . Integer-1 in these clauses specifies the foreground color and background color of the screen item respectively, and can be defined by a value from 0 to 15, as follows:

      0 black 8 grey
      1 blue 9 light blue
      2 green 10 light green
      3 cyan 11 light cyan
      4 red 12 light red
      5 magenta 13 light magenta
      6 brown 14 yellow
      7 white 15 high intensity white

      On a color screen, if the foreground color option specifies an integer whose value is from 8 to 15, this is equivalent to specifying an integer from 0 to 7 and specifying the HIGHLIGHT option. On a monochrome screen, this is equivalent to simply specifying the HIGHLIGHT option.

      On a color screen, if the background color option specifies an integer whose value is from 8 to 15, this is equivalent to specifying an integer from 0 to 7 and specifying the BLINK clause. On a monochrome screen, this is equivalent to simply specifying the BLINK option.

11.4.3 The DISPLAY Statement

General Format

The following format of the DISPLAY statement is supported:

General Rules

  1. The DISPLAY operation treats a group item as an elementary item, if you set the MS Compiler directive when you submit your source code to your COBOL system: it displays the item itself and not its subordinate elementary items.

  2. If the screen position at which the first operand is to appear is not specified, the default is the current cursor position, if you set the MS Compiler directive when you submit your source code to your COBOL system.

  3. Rules 1 and 2 above also apply to Format 2 of the DISPLAY statement in the chapter Program Definition in your Language Reference.

  4. If ERASE is specified, the screen is cleared from the current cursor position onwards.

The following two rules are additional rules which apply to Format 2 of the DISPLAY statement in the chapter Program Definition in your Language Reference.

  1. The WITH phrase options and their synonyms are:

    BACKGROUND-COLOR
    BELL/BEEP
    BLANK
    BLINK
    FOREGROUND-COLOR
    HIGHLIGHT
    REVERSE-VIDEO
    SIZE
    UNDERLINE

  2. FOREGROUND-COLOR and BACKGROUND-COLOR. Integer-1 in these clauses specifies the foreground color and background color of the screen item respectively, and can be defined by a value from 0 to 15, as follows:

    0 black 8 grey
    1 blue 9 light blue
    2 green 10 light green
    3 cyan 11 light cyan
    4 red 12 light red
    5 magenta 13 light magenta
    6 brown 14 yellow
    7 white 15 high intensity white

    On a color screen, if the foreground color option specifies an integer whose value is from 8 to 15, this is equivalent to specifying an integer from 0 to 7 and specifying the HIGHLIGHT clause. On a monochrome screen, this is equivalent to simply specifying the HIGHLIGHT option.

    On a color screen, if the background color option specifies an integer whose value is from 8 to 15, this is equivalent to specifying an integer from 0 to 7 and specifying the BLINK clause. On a monochrome screen, this is equivalent to simply specifying the BLINK option.

11.4.4 The EXHIBIT Statement

An EXHIBIT statement with neither the CHANGED nor the NAMED option behaves as if the NAMED option were specified.

General Format

The following format of the EXHIBIT statement is supported:

Syntax Rules

  1. Mnemonic-name should be associated with sysout, syslist, syslst, syspunch, syspch, console or printer.

General Rules

  1. ERASE clears the screen from the current cursor position onwards.

11.5 Microsoft V2.0 Additional Syntax Support

11.5.1 Record LOCKING

If you set the MS Compiler directive, the LOCKING clause in the SELECT statement is supported.

General Format

General Rules

  1. For SEQUENTIAL and LINE SEQUENTIAL files only EXCLUSIVE locking is allowed.

  2. If MANUAL is specified multiple locks can be applied to the file.

  3. If AUTOMATIC is specified a single lock is applied automatically to the current record.

  4. For SEQUENTIAL and LINE SEQUENTIAL files the default LOCKING mode is EXCLUSIVE.

  5. For RELATIVE and INDEXED files the default LOCKING mode is AUTOMATIC.

  6. If the MANUAL option is specified the UNLOCK statement will release all locks.

11.5.2 OPEN LOCKING Statement

If you set the MS Compiler directive the LOCKING clause in the OPEN statement is supported.

General Format

General Rules

  1. For SEQUENTIAL and LINE SEQUENTIAL files only EXCLUSIVE is allowed.

  2. If the NO LOCKING phase is specified EXCLUSIVE is implied.

11.5.3 READ Statement (in Manual mode)

General Format

General Rules

  1. If you set the MS Compiler directive, the WAIT clause in the READ statement is allowed and treated as documentary.

11.5.4 START Statement

General Format

General Rules

  1. If you set the MS Compiler directive the LOCK and WAIT clauses in the START statement are allowed and treated as documentary.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousDOS/VS COBOL Support Ryan McFarland COBOL V2.0 Syntax SupportNext"