Microsoft KB Archive/32482

Mixed-Language Parameter Passing in COBOL Version 3.0

PSS ID Number: Q32482 Article last modified on 04-21-1993

3.00 | 3.00 MS-DOS | OS/2

Summary: By default, COBOL programs use the large-memory model. Also by default, arguments are passed by reference (i.e., the segment and offset of arguments are PUSHed on the stack, respectively (NOSMALLDD)). Arguments can also be passed by value. All CALLs are far calls unless the COBOL program has been compiled with the small-model directive, SMALLDD. Using the SMALLDD directive, all CALLs are near calls; only offsets are PUSHed on the stack. Data that appears to wrap around in memory is a symptom of near/far assumption conflict, as in the following example: CALL “FRED” USING PARM1 BY VALUE PARM2 PARM3 BY REFERENCE. BY VALUE and BY REFERENCE are transitive; thus PARM1 and PARM2 will be passed BY VALUE. PARM1 and PARM2 cannot be modified in the CALLed program, because a temporary copy of the variable is in use. PARM3 will be passed BY REFERENCE and can therefore be altered by the CALLed program. BY VALUE parameters must be 2 or 4 bytes in length.

More Information: Make sure that variables are the same size and format in each language when passing parameters. Please note that the BY VALUE clause passes arguments by content; the BY REFERENCE clause passes arguments by address.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.