Microsoft KB Archive/40146
How to Use Programmable Invocation Switches in COBOL 3.0
PSS ID Number: Q40146 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: Microsoft COBOL Versions 3.0 and 3.0a offer programmable switches that can be optionally turned on or off when the program is first invoked. These switches can be used to cause a program to execute differently based on the value of the switch at run time.
More Information: Programmable switches are defined in the SPECIAL-NAMES paragraph and are associated with a conditional that can be tested at run time. More information regarding programmable switches can be found on Pages 3-14 and 3-74 in the “Microsoft COBOL Version 3.0: Language Reference Manual” and on Page 5-2 in the “Microsoft COBOL Version 3.0: Operating Guide.” The program shown below (PSWITCH.COB) is an example of how to use programmable switches. If PSWITCH.EXE is invoked on the DOS command line, as follows PSWITCH (+1) then SWITCH-1 is set on, and the program displays the following: “SWITCH-1 IS ON” If PSWITCH.EXE is invoked on the DOS command line, as follows PSWITCH (-1) then SWITCH-1 is set off, and the program displays the following: “SWITCH-1 IS OFF” The following program should be compiled and LINKed accepting the defaults: COBOL PSWITCH.COB; LINK PSWITCH.OBJ; $SET ANS85 VSC2 * pswitch.cob SPECIAL-NAMES. SWITCH-1 IS SWITCH-1 ON STATUS IS SW-1-ON OFF STATUS IS SW-1-OFF. PROCEDURE DIVISION. IF SW-1-ON DISPLAY “SWITCH-1 IS ON”. IF SW-1-OFF DISPLAY “SWITCH-1 IS OFF”. STOP RUN.
Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.