Problem:
After installing runtime licenses (a. k. a. Server for COBOL licenses) on a Linux/UNIX machine, or to test existing licenses, it would be helpful if there were a way to run a given number of COBOL programs simultaneously, without actually running the real-world application, to prove how many COBOL programs can be run simultaneously.
Resolution:
Below is a shell script that will create a simple COBOL program, compile it, then run a given number of simultaneous instances of it. Each instance of the program will do nothing but sleep for a certain number of seconds and then exit.
If the machine in question does not have the COBOL compiler installed (in other words, if the Server for COBOL product is installed and not the Server Express product), then run the script first on a machine that does have Server Express installed, then FTP the file "sl.int" to the machine having just Server for COBOL, then comment-out the part of the script that creates and compiles the "sl.cbl" program.
Before running the script, a person can modify the values:
Number_of_programs_to_run=15 Sleep_time=20
to experiment in different ways.
#!/bin/ksh # Script traditionally named "busy.sh" # Create a simple COBOL program, compile it, then run a given number # of simultaneous instances of it in the background. Each instance # of the program will simply sleep for a certain number of seconds # and then exit. For testing runtime licensing, to prove how many # COBOL programs can successfully be run simultaneously, without # actually running the real application. Number_of_programs_to_run=15 Sleep_time=20 unset COBPATH COBDATA COBCPY COBOPT exec 6>&1 # save stdout before redirecting it exec >sl.cbl # redirect stdout to a file named "sl.cbl" echo " call \\"SYSTEM\\" using \\"sleep $Sleep_time\\" & x\\"00\\"." echo " exit program giving 0." exec 1>&6 6>&- # restore stdout and close file descriptor 6 cob sl.cbl # Compile the program "sl.cbl" n=1 while [ $n -le $Number_of_programs_to_run ] do cobrun sl & # Run an instance of the program in the background n=`expr $n 1` done