Conversion Issues [ COBOL/HP-UX Compatibility Guide for the Series 700 and 800 ] MPE/iX 5.0 Documentation
COBOL/HP-UX Compatibility Guide for the Series 700 and 800
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, there are a number of areas in which incompatibilities may
occur.
Note that any error messages and numbers that may be returned when you
submit your source to this COBOL system or when you execute the resulting
code are different in the two environments. This should present no
problems, but is something you should be aware of.
There are some minor cases where 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.
General
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 section The
Tabx Program in the Chapter 5 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.
COBOL Concepts
COMP-3 Sign Representation.
Under this COBOL system, unsigned COMP-3 fields produce different sign
representation than 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.
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.
The Nucleus
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, you must ensure that
the SPECIAL-NAMES paragraph is inside the Environment Division.
The EJECT Statement.
The EJECT IS ... statement in the SPECIAL-NAMES paragraph is rejected
when you submit your program to this COBOL system.
Solution
You should replace the word EJECT with the word FORMFEED.
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', you
should either alter the `Z' characters to `?' characters, or add a BLANK
WHEN ZERO clause.
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, you
should note that segmentation is an out-dated feature of COBOL and is
treated by the ANSI standard as an obsolete feature.
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, you should move the redefinition so that it is the
next item of the same level, after the item it is redefining.
The VALUE Clause.
A VALUE clause on an INDEX data item will produce errors when you submit
your program to this COBOL system.
Solution
You should 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.
File Input and Output
Filenames.
Incorrect filenames are being used by programs when you run them under
this COBOL system.
Solution
This is probably because all filenames under this COBOL system must be
terminated by a space, whereas under Microsoft COBOL Version 2.2, a null
byte would have terminated the name.
OPEN ... EXTEND.
When opening a non-existent 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.
Record Locking.
* The WAIT clause on a READ statement behaves differently on the two
systems, in that the WAIT clause is actually ignored by this COBOL
system. Instead the file status item will be updated to indicate
that a record is locked.
You should check for the `Record locked' status and loop back to
re-read the record.
* Locking syntax is ignored in the START statement under this COBOL
system.
You can solve this by altering these statements and moving SELECT
the appropriate locking semantics to the SELECT statement and OPEN
or READ statements for the file in question.
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
Using this `feature' of the Microsoft COBOL Version 2.2 system is not
recommended (hence the warning against it in the Microsoft manual), but
if you have used it, it should not prove difficult for you to DELETE
replace the relevant program logic with a simple DELETE statement.
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 that, 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.
Debug
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.
Inter-Program Communication
The ON OVERFLOW Phrase.
Under this COBOL system, when a subprogram is not found, the program does
not stop with an error if there is an ON OVERFLOW phrase on the CALL
statement. 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 within the ON OVERFLOW phrase to handle this.
Note that an error made when coding the program name may cause the ON
OVERFLOW phrase to be followed rather than stopping; this is something
you should be aware of.
Screen Handling
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 that, 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.
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).
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.
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 offending line. For
example:
02 LINE 1 COLUMN 1 ....
02 LINE 1 COLUMN PLUS 1 ....
Clearing the Screen.
Under this COBOL system, you will find that your Microsoft COBOL Version
2.2 programs no longer clear the screen automatically at the start of a
run.
Solution
If you still want this to happen, you can insert the statement:
CALL X"E4"
at the start of the PROCEDURE DIVISION.
Screen Scrolling.
The screen is sometimes scrolled when a program terminates. This only
happens 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 COBOL System Reference.
Sounding the Bell.
When you attempt 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".
Extension Subroutines.
The following Microsoft COBOL Version 2.2 extension subroutines have been
implemented in a slightly different way in this 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 (underline 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, length, status.
should become:
CALL "_MSUPCASE" USING
data-name, LENGTH OF data-name, length,
LENGTH OF length, status
the subroutine:
CALL "LOCASE" USING data-name, length, status.
should become:
CALL "_MSLOCASE" USING
data-name, LENGTH OF data-name, length,
LENGTH OF length, 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
Note that the LENGTH OF syntax used in the way indicated here will
produce a Warning level error message. This message will only appear if
you set the warning level to 2 or 3 using the WARNING directive. The
message can be ignored.
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.
MPE/iX 5.0 Documentation