Microsoft KB Archive/38281

From BetaArchive Wiki

Error 14-S; Use NOOSVS Directive with Reference Modification

PSS ID Number: Q38281 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, versions 3.0 and 3.0a

Summary: When using Reference Modification in conditional sections of IF/ELSE and PERFORM statements in COBOL Version 3.0, you must use the compiler directive NOOSVS. The COBOL Version 3.0 default is OSVS. IBM OS/VS compatibility prohibits the usage of Reference Modification in IF and PERFORM conditions, while allowing Reference Modification to still be used in DISPLAY and MOVE. Reference Modification cannot be used in IF/PERFORM conditions in the same program that needs to use RETURN-CODEs, because of the conflict of the OSVS directive. RETURN-CODE requires the OSVS directive, while NOOSVS is needed for Reference Modification in the IF and PERFORM conditions. Reference Modification can be used in MOVE and DISPLAY statements regardless of the NOOSVS compiler directive.

More Information: For more information about Reference Modification, refer to Pages 2-43 through 2-44 of the “Microsoft COBOL Version 3.0: Language Reference Manual.” For more information about NOOSVS and OSVS, refer to Page 2-40 in the “Microsoft COBOL Version 3.0 Operating Guide.” For more information about RETURN-CODEs, refer to Page 2-47, and Pages 9-19 through 9-20 in the same manual. When using Reference Modification, you must insert the NOOSVS compiler directive into the COBOL.DIR file. When a program uses Reference Modification in IF/PERFORM conditions with Return Codes, set the OSVS compiler directive in the COBOL.DIR file. Then MOVE any Reference Modification to a WORKING-STORAGE SECTION variable, which can be used in the IF/PERFORM conditions. The program below, when compiled with the directives described above (OSVS), will return the following error: 12 until wrk-field(1:1) = “.” ** 14-S************************ ** Invalid operand The following is a code example:

   Working-Storage Section.
   01 working-fields.
      10 wrk-field  pic x(10).
      10 count-run  pic 99     value zero.
   Procedure Division.
        perform testing-ref
           until wrk-field(1:1) = "."
  * ------------------------> See error message above
        stop run.
   testing-ref.
        display "Cycle = ", count-run.
        add 1 to count-run.
        if count-run > 10
           move "." to wrk-field.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.