Microsoft KB Archive/38282

Error 12-S; Use OSVS Directive When Using RETURN-CODE

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

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

Summary: When using RETURN-CODE in a COBOL Version 3.0 program, you must use the compiler directive OSVS. OSVS is a default directive. This designates RETURN-CODE as a reserved word and allows the calling COBOL program to retrieve a 2 or 4 byte RETURN-CODE from called programs. The size of the RETURN-CODE is determined at compile time by the compiler directive RTNCODE-SIZE. RETURN-CODE cannot be used in conjunction with Reference Modification in IF/PERFORM conditions. This is a conflict of compiler directives. OSVS is used with RETURN-CODE, while NOOSVS is used with Reference Modification in IF/PERFORM statements. When NOOSVS is used, an error message will be generated for every reference to RETURN-CODE in the program. 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 RETURN-CODEs, you must insert the OSVS 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 run with the directives described above (NOOSVS), will return the following error: 11 if RETURN-CODE = 0 then ** 12-S****************** ** Operand is not declared The following is a code example:

Working-Storage Section. 01 pgm-name  pic x(25). Procedure Division. move &quot;hi&quot; to pgm-name. call pgm-name. * <--- this will generate the above error if RETURN-CODE = 0 display &quot;RTN = 0&quot;. stop run. Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.