Skip to main content

Problem:

The Object COBOL Developer Suite (OCDS) manual states that if the HOST-NUMCOMPARE compiler directive is used it MUST have a value setting of 1 or 2.  (e.g $set HOST-NUMCOMPARE"1"). What is not stated is that if no value is set (i.e. $set HOST-NUMCOMPARE) it assumes the same behaviour as if HOST-NUMCOMPARE"1" were set.

The Server Express manual make no mention of the values 1 or 2 being required. It states that the allowable settings are either NOHOST-NUMCOMPARE (default) or HOST-NUMCOMPARE.

However, the behaviour for the setting $set HOST-NUMCOMPARE (without 1 or 2 set) differs in that in Server Express it assumes the same behaviour as if NOHOST-NUMCOMPARE were set.

Resolution:

To get the same behaviour in Server Express as in Object COBOL Developer Suite for the setting:

If you have the following set in Server Express:

$set HOST-NUMCOMPARE

you should try the setting:

$set HOST-NUMCOMPARE"1"

even though it does not state this as an option in the Server Express manual.

Where this may be of importance is if HOST-NUMCOMPARE is used in conjunction with the SPZERO directive. This combination will mostly be used for applications originally migrated from a mainframe where data items may not have been initialized.

As an example, test the following code by varying the settings of HOST-NUMCOMPARE (including removing it altogether) as well as removing and reinstating SPZERO. Try this in both OCDS and SX.

      $set SPZERO

      $set HOST-NUMCOMPARE

      *set HOST-NUMCOMPARE"1"           (commented out)

      *****************************************

        Working-storage section.

      *  Field not initialized

         01  Field-A             Pic 9.

           88  A-On            Value is 0.

           88  A-Off           Value is 1.

      *  Field initialized

       01  Field-B             Pic 9 Value 0.

           88  B-On            Value is 0.

           88  B-Off           Value is 1.

      * ....

       Procedure Division.

       Start-Routine.

          * Field-A will always contain a SPACE

          * SPZERO should force it to be treated as ZERO

           Display "A= " At 0801.

           Display Field-A At 0804.

           If  A-On

               Display "Value in Field A is interpretted as 0" At 1001

           Else

               Display "Value in Field A is interpretted as NOT 0" At 1001.

          * Field-B has been correctly initialized and SPZERO will have no effect

  

           Display "B= " At 1401.

           Display Field-B At 1404.

           If  B-On

               Display "Value in Field B is 0" At 1601

           Else

               Display "Value in Field B is NOT 0" At 1601.

           STOP RUN.

Old KB# 7263