Compaq COBOL for OpenVMS VAX and Compaq COBOL Compatibility and Migration
B.4 Compaq COBOL and Compaq COBOL for OpenVMS VAX Behavior Differences
B.4.4.3 MOVE Statement
Unsigned computational fields can hold larger values than signed computational
fields. In accordance with the ANSI COBOL Standard, the values for unsigned
items should always be treated as positive. Compaq COBOL for OpenVMS VAX,
however, treats unsigned items as signed, while Compaq COBOL treats them as
positive. Therefore, in some rare cases, a mixture of unsigned and signed data
items in MOVE or arithmetic statements can produce different results between
Compaq COBOL for OpenVMS VAX and Compaq COBOL.
Example B–1 produces different results for Compaq COBOL for OpenVMS VAX
and Compaq COBOL.
Example B–1 Signed and Unsigned Differences
IDENTIFICATION DIVISION.
PROGRAM-ID. SHOW-DIFF.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A2 PIC 99 COMP.
01 B1 PIC S9(5) COMP.
01 B2 PIC 9(5) COMP.
PROCEDURE DIVISION.
TEST-1.
MOVE 65535 TO A2.
MOVE A2 TO B1.
DISPLAY B1 WITH CONVERSION.
MOVE A2 TO B2.
DISPLAY B2 WITH CONVERSION.
STOP RUN.
Compaq COBOL for OpenVMS VAX Results
B1 = -1
B2 = -1
Compaq COBOL Results
B1 = 65535
B2 = 65535
B.4.4.4 SEARCH Statement
In Compaq COBOL and in Compaq COBOL for OpenVMS VAX Version 5.0
and higher, the END-SEARCH and NEXT SENTENCE phrases are mutually
incompatible in a SEARCH statement. If you use one, you must not use the
other. This rule, which complies with the ANSI COBOL Standard, does not apply
to Compaq COBOL for OpenVMS VAX versions earlier than Version 5.0.
B.4.5 System Return Codes
Example B–2 illustrates an illegal coding practice that exhibits different behavior
on Compaq COBOL and Compaq COBOL for OpenVMS VAX. The cause is
an architectural difference in the register sets between the VAX and Alpha
architectures: on Alpha, there is a separate set of registers for floating-point data
types.
B–18 Compaq COBOL for OpenVMS VAX and Compaq COBOL Compatibility and Migration