Skip to main content

Different behaviour with COMPUTE statement / Server Express vs. OCDS

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

Running the following piece of code through OCDS and then Server Express will return different results on the COMPUTE statement:

FD

01 TOT-CALC                 PIC 9(02) VALUE ZEROES.

    01  FILLER REDEFINES TOT-CALC.

        03  TOT-1            PIC 9(01).

        03  TOT-2            PIC 9(01).

01 NUMERO-ASSEGNO           PIC 9(10) VALUE ZEROES.

01 TAB-NUM REDEFINES NUMERO-ASSEGNO.

  03  EL-NUM               PIC 9(01) OCCURS 10.

PROCEDURE DIVISION.

COMPUTE EL-NUM(10) = 10 - TOT-2

The value of TOT-2 is 0(ZERO).

In OCDS the result of: EL-NUM(10) = 0

but in Server Express:  EL-NUM(10) = ":"  non-numeric value

Resolution:

The solution to this problem is to compile the code in Server Express using the HOSTARITHMETIC compiler directive.

Old KB# 3692