A common practice in COBOL programming is to manage switches to change the behavior of the program.
In isCOBOL there are four ways to accomplish this task:
iscobol.switches=1will activate only switch 1,
iscobol.switches=3will activate only switch 3,
iscobol.switches=1,3will activate switchs 1 and 3
iscrun -c switch.properties MAIN
iscrun -J-Discobol.switches=1 MAINwill activate only switch 1
iscrun -J-Discobol.switches=3 MAINwill activate only switch 3
iscrun -J-Discobol.switches=1,3 MAINwill activate switchs 1 and 3
set switches=1will activate only switch 1
set switches=3will activate only switch 3
set switches=1, 3will activate switchs 1 and 3
export switches=1will activate only switch 1
export switches=3will activate only switch 1
export switches=1, 3will activate switchs 1 and 3
iscrun MAIN
set sw-2 to on
If you want to clear the switches at the end of the process, you can set the switches to blank or space. For example:
set SWITCHES=
Attached to this KB article is a .zip file containing two sample programs and a configuration file that show how to work with switches.
You can use them to test the 4 ways to set switches outlined above.
Unzip the files, and compile them with
iscc *.cbl
Article ID: 339
Created: July 3, 2023
Last Updated: July 3, 2023
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=339