Example: results of compiling and running examples
This example shows how you can compile, link, and run COBOL programs cobcallc.cbl and tprog.cbl and the C program MyFun.c, and shows the results of running the programs.
Compile and link cobcallc.cbl, tprog.cbl, and MyFun.c by issuing the following commands:
gcc -m32 -c MyFun.c
cob2 cobcallc.cbl MyFun.o tprog1.cbl -o cobcallc
Run the program by issuing the command cobcallc
. The results are
as
follows:
call MyFun with n4=00123 ns4=-00567 n9=0098765432
ns9=-0013579456 ns18=.22222000000000000E 03
MyFun got s1=123 s2=-567 k1=98765432 k2=-13579456 x=444.440000
n4=01024 and ns9= n4 times n4= 0001048576
TPROG1 got x= .11223344000000000E 04
d1=-.35792568025000000E 09 and d2= 2.0 times d2= -.71585136050000000E 09
MyFunV got 11111 22222 33333