PreviousIBM/370 Mainframe Compatibility RebuildNext"

Chapter 2: Microsoft COBOL V2.2 Source Compatibility

Conversion Series 2 supports certain extensions which allow you to submit source programs written in Microsoft COBOL Version 2.2 directly to this COBOL system. This chapter describes the directives you may need to set to submit your Microsoft V2.2 programs to this COBOL system, and also gives hints on how to avoid possible areas of difficulty when you submit your programs.

Microsoft COBOL V2.2 is a DOS system. The compatibility issues described in this Part, however, apply to all versions of this COBOL system, with the following restriction:


Restriction: Data file conversion using Rebuild, and the Microsoft COBOL V2.2 extension routines, are not supported in UNIX versions of this COBOL system.


2.1 Configuring your System

Before submitting your Microsoft COBOL V2.2 programs to this COBOL system, you must:

2.2 Migrating your Application

When you have configured this COBOL system, you can then submit your Microsoft COBOL Version 2.2 programs to it. For the command to do this, see your Release Notes.

2.3 Conversion Issues

Most of the Microsoft COBOL Version 2.2 programs which you submit to this COBOL system will be accepted syntactically and will run successfully. However, incompatibilities may occur in a number of areas.

In some minor cases, this COBOL system will produce errors when encountering missing periods or spelling errors (for example, SOURCE COMPUTER in place of SOURCE-COMPUTER is not acceptable).

The sections below detail the known features which could produce errors, or which may not behave in the way you expect, along with hints on how to rectify the cause of such errors, or emulate the behavior of Microsoft COBOL Version 2.2 programs.

2.3.1 General

2.3.1.1 Source Code Beyond Column 72

This condition occurs if the standard TAB settings on the Microsoft COBOL Version 2.2 Compiler have been changed either by patching the run-time system, or by using the /O directive.

Solution

Before submitting your Microsoft COBOL Version 2.2 program to this COBOL system, process the program with the tabx utility (see the chapter Converting an RM/COBOL Application in the Conversion Series 3 Part for details of how to do this). This expands any tab characters into spaces. You can then successfully submit your source programs to this COBOL system.

2.3.2 COBOL Concepts

2.3.2.1 COMP-3 Sign Representation

Under this COBOL system, unsigned COMP-3 fields produce different sign representation from that of Microsoft COBOL Version 2.2.

Solution

You must ensure that you specify the MS"2" system directive which will cause unsigned COMP-3 fields to be treated in the same way as they were under Microsoft COBOL Version 2.2; that is, as signed positive. This directive is automatically set by the Setup utility if you select the Microsoft Version 2.2 option.

2.3.2.2 Declaratives

Any declaratives statement which appears after a paragraph header is rejected when you submit your program to this COBOL system.

Solution

This COBOL system insists that the declaratives statement immediately follows the section header, rather than the paragraph header. Amend your source program and resubmit it to this COBOL system.

2.3.3 The Nucleus

2.3.3.1 Special-Names Paragraphs

You may receive an error on the SPECIAL-NAMES paragraph header when you submit your program to this COBOL system.

Solution

When you submit your program to this COBOL system, ensure that the SPECIAL-NAMES paragraph is inside the Environment Division.

2.3.3.2 The EJECT Statement

The EJECT IS ... statement in the SPECIAL-NAMES paragraph is rejected when you submit your program to this COBOL system.

Solution

Replace the word EJECT with the word FORMFEED .

2.3.3.3 PICTURE Strings

Items with PICTURE clauses such as "-.ZZ" may produce errors when you submit your program to this COBOL system.

Solution

If you receive errors for picture-strings which contain a "-" (minus) followed by a " . " (period), or a " . " followed by a "Z", either alter the "Z" characters to "?" characters, or add a BLANK WHEN ZERO clause.

2.3.3.4 The SEGMENT-LIMIT Clause

The SEGMENT-LIMIT IS ... clause is treated as documentary by this COBOL system, although this should not produce any problems. However, segmentation is an out-dated feature of COBOL and is treated by the ANSI standard as an obsolete feature.

2.3.3.5 The REDEFINES Clause

Certain usage of the REDEFINES clause in a Microsoft COBOL Version 2.2 program will produce errors when you submit your program to this COBOL system. For example:

03 A. 
 ... 
03 B. 
 ... 
03 C REDEFINES A.

is not accepted by this COBOL system because C is not the next item of the same level after A.

Solution

In the above example, move the redefinition so that it is the next item of the same level, after the item it is redefining.

2.3.3.6 The VALUE Clause

A VALUE clause on an INDEX data item will produce errors when you submit your program to this COBOL system.

Solution

Remove the VALUE clause and use the SET statement at the start of the Procedure Division to supply an initial value to the INDEX data item.

2.3.4 File Input and Output

2.3.4.1 Filenames

Incorrect filenames are being used by programs when you run them under this COBOL system.

Solution

All filenames under this COBOL system must be terminated by a space, whereas under Microsoft COBOL Version 2.2, a file-name must be terminated by a null byte.

2.3.4.2 OPEN ... EXTEND

When opening a nonexistent file EXTEND, this COBOL system, unlike Microsoft COBOL Version 2.2, does not create the file.

Solution

You can solve this by placing the word OPTIONAL after the word SELECT for this file.

2.3.4.3 Record Locking

2.3.4.4 Deleting Relative Records

Records in a relative file are not deleted by this COBOL system if they are rewritten with the first byte containing LOW-VALUES.

Solution

In accordance with the warning in the Microsoft manual, we recommend that you do not use this feature of the Microsoft COBOL Version 2.2 system, but if you have used it, you should be able to replace the relevant program logic with a simple DELETE statement .

2.3.4.5 Rebuild

The current version of Rebuild does not allow you to reorganize files so that the keys are in descending order.

Solution

If any of your programs rely on this ordering of the records, it can be simulated by first positioning on the last record in the file (using a START <= statement with HIGH-VALUES in the key) and then using the READ PREVIOUS syntax.


Note: To enable the READ PREVIOUS syntax , you must specify the MF"3" system directive, although when you do, it enables some other reserved words. See your Language Reference for details of these reserved words.


2.3.5 Debug

2.3.5.1 TRACE Statements

The READY TRACE and RESET TRACE statements do not have any effect under this COBOL system.

Solution

You should specify the directive TRACE when you submit your program to this COBOL system and these statements will function correctly.

2.3.6 Inter-Program Communication

2.3.6.1 The ON OVERFLOW Phrase

Under this COBOL system, when a subprogram is not found, an ON OVERFLOW phrase on the CALL statement does not cause the program to stop with an error. Instead, the ON OVERFLOW path is followed if the subprogram is not found (and also if there is insufficient memory).

Solution

It is very unlikely that any application is relying on a program to stop with a fatal error. However, if this is the case, you should change the logic in the ON OVERFLOW phrase to handle this.


Note: An error made when coding the program-name may cause the ON OVERFLOW phrase to be followed rather than stopping; this is something of which you should be aware.


2.3.7 Screen Handling

2.3.7.1 Accepting into Numeric Fields

Integer numeric fields are accepted differently because numeric edited fields insert digits from right to left under this COBOL system.

Solution

Change the picture-string on this COBOL system from 9(n) to Z(n) and the insertion behavior will be the same as under Microsoft COBOL Version 2.2.


Note: Numeric operations cannot be performed on a numeric edited field. If you do wish to perform numeric operations on this item, you must move it to a numeric item.


2.3.7.2 Accepting into Alphabetic Fields

Alphabetic fields do not allow non-alphabetic characters to be accepted into them under this COBOL system.

Solution

Change the PIC A(n) of the field in question to PIC X(n).

2.3.7.3 Numeric edited Items

The Screen Section syntax, numeric-edited-item FROM group-item, does not convert to edited format under this COBOL system.

Solution

Make the object of the FROM phrase an elementary numeric item and redefine it if the individual components are required.

2.3.7.4 Incorrect Spacing

The Screen Section clause COLUMN PLUS 1 does not give the correct intervening space under some circumstances. For example, the lines:

02 line 1 column 1 .... 
02        column plus 1 .... 

will not put a space in column 2.

Solution

You should include an explicit LINE clause in the line in error. For example:

02 line 1 column 1 .... 
02 line 1 column plus 1 .... 

2.3.7.5 Clearing the Screen

Under this COBOL system, your Microsoft COBOL Version 2.2 programs do not clear the screen automatically at the start of a run.

Solution

If you want this to happen, you can insert the statement:

call x"e4"

at the start of the Procedure Division.

2.3.7.6 Screen Scrolling

The screen is sometimes scrolled when a program terminates. This happens only if the cursor is on the last line of the screen when the STOP RUN statement is obeyed, and is caused by a request for the operating system prompt.

Solution

Simply include the following CALL statement immediately before the STOP RUN statement to position the cursor away from the last line:

call x"e6" using result, parameter

For details of this subroutine, see your Programmer's Guide to Creating User Interfaces.

2.3.7.7 Sounding the Bell

When you try to sound the bell by displaying an item containing hexadecimal 7, under this COBOL system, a diamond appears on the screen instead. This is because the functionality of the ACCEPT/DISPLAY module has been changed (and considerably enhanced) in this COBOL system.

Solution

To sound the bell, change this DISPLAY statement in your source program to the statement:

call x"e5"

2.3.7.8 Extension Subroutines

16-bit only
The following Microsoft COBOL Version 2.2 extension subroutines have been implemented in a slightly different way on the 16-bit COBOL system:

EXIST
RENAME
REMOVE
COMMAND
UPCASE
LOCASE
EXCODE
KBDAVAIL
CURPOS

To avoid a possible clash with other dialects, the subroutine-names have been prefaced with _MS (underscore MS), and the length of parameters must be passed to the routines (this is performed by the LENGTH OF syntax). Therefore, the subroutine:

call "EXIST" using file-name, status

should become:

call "_MSEXIST" using 
     file-name, LENGTH OF file-name, status

the subroutine:

call "RENAME" using 
     old-file-name, new-file-name, status

should become:

call "_MSRENAME" using 
     old-file-name, LENGTH OF old-file-name, 
     new-file-name, LENGTH OF new-file-name, 
     status

the subroutine:

call "REMOVE" using file-name, status

should become:

call "_MSREMOVE" using 
     file-name, LENGTH OF file-name, status

the subroutine:

call "COMMAND" using command-line

should become:

call "_MSCOMMAND" using 
     command-line, LENGTH OF command-line

the subroutine:

call "UPCASE" using data-name, number-of-chars-to-convert, status

should become:

call "_MSUPCASE" using 
            data-name, LENGTH OF data-name,
         number-of-chars-to-convert, 
            LENGTH OF number-of-chars-to-convert,
         status

the subroutine:

call "LOCASE" using data-name, number-of-chars-to-convert, status

should become:

call "_MSLOCASE" using 
            data-name, LENGTH OF data-name,                                                  number-of-chars-to-convert, 
            LENGTH OF number-of-chars-to-convert,
         status

the subroutine:

call "EXCODE" using exit-code

should become:

call "_MSEXCODE" using 
                    exit-code, LENGTH OF exit-code

the subroutine:

call "KBDAVAIL" using status 

should become:

call "_MSKBDAVAIL" using status 

and the subroutine:

call "CURPOS" using line-number,
                    column-number

should become:

call "_MSCURPOS" using line-number, 
                       column-number

The LENGTH OF syntax used in the way indicated here will produce a Warning level error message. This message will appear only if you set the warning level to 2 or 3 using the WARNING directive. The message can be ignored.

2.4 Add-on Products from Micro Focus

The range of Micro Focus add-on products available for use with this system is designed to work with the default system configuration. You should, therefore, be aware that if you use any of these add-on products and you submit your program to a system with a different configuration, the results may be unpredictable.


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

PreviousIBM/370 Mainframe Compatibility RebuildNext"